summaryrefslogtreecommitdiff
path: root/vendor/github.com/aws/smithy-go/encoding/json/encoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aws/smithy-go/encoding/json/encoder.go')
-rw-r--r--vendor/github.com/aws/smithy-go/encoding/json/encoder.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/aws/smithy-go/encoding/json/encoder.go b/vendor/github.com/aws/smithy-go/encoding/json/encoder.go
new file mode 100644
index 0000000..8772953
--- /dev/null
+++ b/vendor/github.com/aws/smithy-go/encoding/json/encoder.go
@@ -0,0 +1,30 @@
+package json
+
+import (
+ "bytes"
+)
+
+// Encoder is JSON encoder that supports construction of JSON values
+// using methods.
+type Encoder struct {
+ w *bytes.Buffer
+ Value
+}
+
+// NewEncoder returns a new JSON encoder
+func NewEncoder() *Encoder {
+ writer := bytes.NewBuffer(nil)
+ scratch := make([]byte, 64)
+
+ return &Encoder{w: writer, Value: newValue(writer, &scratch)}
+}
+
+// String returns the String output of the JSON encoder
+func (e Encoder) String() string {
+ return e.w.String()
+}
+
+// Bytes returns the []byte slice of the JSON encoder
+func (e Encoder) Bytes() []byte {
+ return e.w.Bytes()
+}