Documentation ¶
Index ¶
- func ReturnStream(stream *Stream)
- type JsonConfig
- type Stream
- func (stream *Stream) Available() int
- func (stream *Stream) Buffer() []byte
- func (stream *Stream) Buffered() int
- func (stream *Stream) Flush() error
- func (stream *Stream) Reset(out io.Writer)
- func (stream *Stream) SetBuffer(buf []byte)
- func (stream *Stream) Write(p []byte) (nn int, err error)
- func (stream *Stream) WriteArrayEnd()
- func (stream *Stream) WriteArrayStart()
- func (stream *Stream) WriteBool(val bool)
- func (stream *Stream) WriteByte(c byte)
- func (stream *Stream) WriteEmptyArray()
- func (stream *Stream) WriteEmptyObject()
- func (stream *Stream) WriteFalse()
- func (stream *Stream) WriteFloat32(val float32)
- func (stream *Stream) WriteFloat32Lossy(val float32)
- func (stream *Stream) WriteFloat64(val float64)
- func (stream *Stream) WriteFloat64Lossy(val float64)
- func (stream *Stream) WriteInt(val int)
- func (stream *Stream) WriteInt16(nval int16)
- func (stream *Stream) WriteInt32(nval int32)
- func (stream *Stream) WriteInt64(nval int64)
- func (stream *Stream) WriteInt8(nval int8)
- func (stream *Stream) WriteMore()
- func (stream *Stream) WriteNil()
- func (stream *Stream) WriteObjectEnd()
- func (stream *Stream) WriteObjectField(field string)
- func (stream *Stream) WriteObjectStart()
- func (stream *Stream) WriteRaw(s string)
- func (stream *Stream) WriteString(s string)
- func (stream *Stream) WriteStringByte(c byte)
- func (stream *Stream) WriteTrue()
- func (stream *Stream) WriteUint(val uint)
- func (stream *Stream) WriteUint16(val uint16)
- func (stream *Stream) WriteUint32(val uint32)
- func (stream *Stream) WriteUint64(val uint64)
- func (stream *Stream) WriteUint8(val uint8)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReturnStream ¶
func ReturnStream(stream *Stream)
Types ¶
type JsonConfig ¶
type JsonConfig struct {
// contains filtered or unexported fields
}
func NewJsonConfig ¶
func NewJsonConfig(indentionStep int) *JsonConfig
type Stream ¶
type Stream struct { Error error Attachment interface{} // open for customized encoder // contains filtered or unexported fields }
stream is a io.Writer like object, with JSON specific write functions. Error is not returned as return value, but stored as Error member on this stream instance.
func BorrowStream ¶
func NewStream ¶
func NewStream(cfg *JsonConfig, out io.Writer, bufSize int) *Stream
NewStream create new stream instance. out can be nil if write to internal buffer. bufSize is the initial size for the internal buffer in bytes.
func (*Stream) Buffered ¶
Buffered returns the number of bytes that have been written into the current buffer.
func (*Stream) Write ¶
Write writes the contents of p into the buffer. It returns the number of bytes written. If nn < len(p), it also returns an error explaining why the write is short.
func (*Stream) WriteArrayEnd ¶
func (stream *Stream) WriteArrayEnd()
WriteArrayEnd write ] with possible indention
func (*Stream) WriteArrayStart ¶
func (stream *Stream) WriteArrayStart()
WriteArrayStart write [ with possible indention
func (*Stream) WriteEmptyObject ¶
func (stream *Stream) WriteEmptyObject()
WriteEmptyObject write {}
func (*Stream) WriteFloat32 ¶
WriteFloat32 write float32 to stream
func (*Stream) WriteFloat32Lossy ¶
WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster
func (*Stream) WriteFloat64 ¶
WriteFloat64 write float64 to stream
func (*Stream) WriteFloat64Lossy ¶
WriteFloat64Lossy write float64 to stream with ONLY 17 digits precision although much much faster
func (*Stream) WriteInt16 ¶
WriteInt16 write int16 to stream
func (*Stream) WriteInt32 ¶
WriteInt32 write int32 to stream
func (*Stream) WriteInt64 ¶
WriteInt64 write int64 to stream
func (*Stream) WriteMore ¶
func (stream *Stream) WriteMore()
WriteMore write , with possible indention
func (*Stream) WriteObjectEnd ¶
func (stream *Stream) WriteObjectEnd()
WriteObjectEnd write } with possible indention
func (*Stream) WriteObjectField ¶
WriteObjectField write "field": with possible indention
func (*Stream) WriteObjectStart ¶
func (stream *Stream) WriteObjectStart()
WriteObjectStart write { with possible indention
func (*Stream) WriteString ¶
WriteString write string to stream without html escape
func (*Stream) WriteStringByte ¶
func (*Stream) WriteUint16 ¶
WriteUint16 write uint16 to stream
func (*Stream) WriteUint32 ¶
WriteUint32 write uint32 to stream
func (*Stream) WriteUint64 ¶
WriteUint64 write uint64 to stream
func (*Stream) WriteUint8 ¶
WriteUint8 write uint8 to stream