easyjson: github.com/mailru/easyjson/jwriter Index | Files

package jwriter

import "github.com/mailru/easyjson/jwriter"

Package jwriter contains a JSON writer.

Index

Package Files

writer.go

type Flags Uses

type Flags int

Flags describe various encoding options. The behavior may be actually implemented in the encoder, but Flags field in Writer is used to set and pass them around.

const (
    NilMapAsEmpty   Flags = 1 << iota // Encode nil map as '{}' rather than 'null'.
    NilSliceAsEmpty                   // Encode nil slice as '[]' rather than 'null'.
)

type Writer Uses

type Writer struct {
    Flags Flags

    Error        error
    Buffer       buffer.Buffer
    NoEscapeHTML bool
}

Writer is a JSON writer.

func (*Writer) Base64Bytes Uses

func (w *Writer) Base64Bytes(data []byte)

Base64Bytes appends data to the buffer after base64 encoding it

func (*Writer) Bool Uses

func (w *Writer) Bool(v bool)

func (*Writer) BuildBytes Uses

func (w *Writer) BuildBytes(reuse ...[]byte) ([]byte, error)

BuildBytes returns writer data as a single byte slice. You can optionally provide one byte slice as argument that it will try to reuse.

func (*Writer) DumpTo Uses

func (w *Writer) DumpTo(out io.Writer) (written int, err error)

DumpTo outputs the data to given io.Writer, resetting the buffer.

func (*Writer) Float32 Uses

func (w *Writer) Float32(n float32)

func (*Writer) Float32Str Uses

func (w *Writer) Float32Str(n float32)

func (*Writer) Float64 Uses

func (w *Writer) Float64(n float64)

func (*Writer) Float64Str Uses

func (w *Writer) Float64Str(n float64)

func (*Writer) Int Uses

func (w *Writer) Int(n int)

func (*Writer) Int16 Uses

func (w *Writer) Int16(n int16)

func (*Writer) Int16Str Uses

func (w *Writer) Int16Str(n int16)

func (*Writer) Int32 Uses

func (w *Writer) Int32(n int32)

func (*Writer) Int32Str Uses

func (w *Writer) Int32Str(n int32)

func (*Writer) Int64 Uses

func (w *Writer) Int64(n int64)

func (*Writer) Int64Str Uses

func (w *Writer) Int64Str(n int64)

func (*Writer) Int8 Uses

func (w *Writer) Int8(n int8)

func (*Writer) Int8Str Uses

func (w *Writer) Int8Str(n int8)

func (*Writer) IntStr Uses

func (w *Writer) IntStr(n int)

func (*Writer) Raw Uses

func (w *Writer) Raw(data []byte, err error)

Raw appends raw binary data to the buffer or sets the error if it is given. Useful for calling with results of MarshalJSON-like functions.

func (*Writer) RawByte Uses

func (w *Writer) RawByte(c byte)

RawByte appends raw binary data to the buffer.

func (*Writer) RawString Uses

func (w *Writer) RawString(s string)

RawByte appends raw binary data to the buffer.

func (*Writer) RawText Uses

func (w *Writer) RawText(data []byte, err error)

RawText encloses raw binary data in quotes and appends in to the buffer. Useful for calling with results of MarshalText-like functions.

func (*Writer) ReadCloser Uses

func (w *Writer) ReadCloser() (io.ReadCloser, error)

ReadCloser returns an io.ReadCloser that can be used to read the data. ReadCloser also resets the buffer.

func (*Writer) Size Uses

func (w *Writer) Size() int

Size returns the size of the data that was written out.

func (*Writer) String Uses

func (w *Writer) String(s string)

func (*Writer) Uint Uses

func (w *Writer) Uint(n uint)

func (*Writer) Uint16 Uses

func (w *Writer) Uint16(n uint16)

func (*Writer) Uint16Str Uses

func (w *Writer) Uint16Str(n uint16)

func (*Writer) Uint32 Uses

func (w *Writer) Uint32(n uint32)

func (*Writer) Uint32Str Uses

func (w *Writer) Uint32Str(n uint32)

func (*Writer) Uint64 Uses

func (w *Writer) Uint64(n uint64)

func (*Writer) Uint64Str Uses

func (w *Writer) Uint64Str(n uint64)

func (*Writer) Uint8 Uses

func (w *Writer) Uint8(n uint8)

func (*Writer) Uint8Str Uses

func (w *Writer) Uint8Str(n uint8)

func (*Writer) UintStr Uses

func (w *Writer) UintStr(n uint)

func (*Writer) UintptrStr Uses

func (w *Writer) UintptrStr(n uintptr)

Package jwriter imports 4 packages (graph) and is imported by 509 packages. Updated 2018-03-12. Refresh now. Tools for package owners.