codec

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BYTE byte = iota
	SHORT
	INT
	LONG
	FLOAT
	DOUBLE
	STRING1
	STRING4
	MAP
	LIST
	STRUCT_BEGIN
	STRUCT_END
	ZERO_TAG
	SIMPLE_LIST
)

jce type

Variables

This section is empty.

Functions

func FromInt8

func FromInt8(vec []int8) []byte

FromInt8 NewReader(FromInt8(vec))

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is wrapper of bytes.Buffer

func NewBuffer

func NewBuffer() *Buffer

NewBuffer returns *Buffer

func (*Buffer) Grow

func (b *Buffer) Grow(size int)

Grow grows the size of the buffer.

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset clean the buffer.

func (*Buffer) ToBytes

func (b *Buffer) ToBytes() []byte

ToBytes make the buffer to []byte

func (*Buffer) WriteHead

func (b *Buffer) WriteHead(ty byte, tag byte) error

func (*Buffer) Write_bool

func (b *Buffer) Write_bool(data bool, tag byte) error

Write_bool write bool with the tag.

func (*Buffer) Write_float32

func (b *Buffer) Write_float32(data float32, tag byte) error

Write_float32 writes float32 with the tag.

func (*Buffer) Write_float64

func (b *Buffer) Write_float64(data float64, tag byte) error

Write_float64 writes float64 with the tag.

func (*Buffer) Write_int16

func (b *Buffer) Write_int16(data int16, tag byte) error

Write_int16 writes the int16 with the tag.

func (*Buffer) Write_int32

func (b *Buffer) Write_int32(data int32, tag byte) error

Write_int32 write int32 with the tag.

func (*Buffer) Write_int64

func (b *Buffer) Write_int64(data int64, tag byte) error

Write_int64 write int64 with the tag.

func (*Buffer) Write_int8

func (b *Buffer) Write_int8(data int8, tag byte) error

Write_int8 write int8 with the tag.

func (*Buffer) Write_slice_int8

func (b *Buffer) Write_slice_int8(data []int8) error

Write_slice_int8 wirte []int8 to the buffer.

func (*Buffer) Write_slice_uint8

func (b *Buffer) Write_slice_uint8(data []uint8) error

Write_slice_uint8 wirte []uint8 to the buffer.

func (*Buffer) Write_string

func (b *Buffer) Write_string(data string, tag byte) error

Write_string writes string data with the tag.

func (*Buffer) Write_uint16

func (b *Buffer) Write_uint16(data uint16, tag byte) error

Write_uint16 write uint16 with the tag.

func (*Buffer) Write_uint32

func (b *Buffer) Write_uint32(data uint32, tag byte) error

Write_uint32 write uint32 data with the tag.

func (*Buffer) Write_uint8

func (b *Buffer) Write_uint8(data uint8, tag byte) error

Write_uint8 write uint8 with the tag

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is wapper of bytes.Reader

func NewReader

func NewReader(data []byte) *Reader

NewReader returns *Reader

func (*Reader) Next

func (b *Reader) Next(n int) []byte

Next return the []byte of next n .

func (*Reader) Read_bool

func (b *Reader) Read_bool(data *bool, tag byte, require bool) error

Read_bool reads the bool value for the tag and the require or optional sign.

func (*Reader) Read_float32

func (b *Reader) Read_float32(data *float32, tag byte, require bool) error

Read_float32 reads the float32 value for the tag and the require or optional sign.

func (*Reader) Read_float64

func (b *Reader) Read_float64(data *float64, tag byte, require bool) error

Read_float64 reads the float64 value for the tag and the require or optional sign.

func (*Reader) Read_int16

func (b *Reader) Read_int16(data *int16, tag byte, require bool) error

Read_int16 reads the int16 value for the tag and the require or optional sign.

func (*Reader) Read_int32

func (b *Reader) Read_int32(data *int32, tag byte, require bool) error

Read_int32 reads the int32 value for the tag and the require or optional sign.

func (*Reader) Read_int64

func (b *Reader) Read_int64(data *int64, tag byte, require bool) error

Read_int64 reads the int64 value for the tag and the require or optional sign.

func (*Reader) Read_int8

func (b *Reader) Read_int8(data *int8, tag byte, require bool) error

Read_int8 reads the int8 data for the tag and the require or optional sign.

func (*Reader) Read_slice_int8

func (b *Reader) Read_slice_int8(data *[]int8, len int32, require bool) error

Read_slice_int8 reads []int8 for the given length and the require or optional sign.

func (*Reader) Read_slice_uint8

func (b *Reader) Read_slice_uint8(data *[]uint8, len int32, require bool) error

Read_slice_uint8 reads []uint8 fore the given length and the require or optional sign.

func (*Reader) Read_string

func (b *Reader) Read_string(data *string, tag byte, require bool) error

Read_string reads the string value for the tag and the require or optional sign.

func (*Reader) Read_uint16

func (b *Reader) Read_uint16(data *uint16, tag byte, require bool) error

Read_uint16 reads the uint16 value for the tag and the require or optional sign.

func (*Reader) Read_uint32

func (b *Reader) Read_uint32(data *uint32, tag byte, require bool) error

Read_uint32 reads the uint32 value for the tag and the require or optional sign.

func (*Reader) Read_uint8

func (b *Reader) Read_uint8(data *uint8, tag byte, require bool) error

Read_uint8 reads the uint8 for the tag and the require or optional sign.

func (*Reader) Skip

func (b *Reader) Skip(n int)

Skip Skip the next n byte.

func (*Reader) SkipTo

func (b *Reader) SkipTo(ty, tag byte, require bool) (error, bool)

SkipTo skip to the given tag.

func (*Reader) SkipToNoCheck

func (b *Reader) SkipToNoCheck(tag byte, require bool) (error, bool, byte)

SkipToNoCheck for skip to the none STRUCT_END tag.

func (*Reader) SkipToStructEnd

func (b *Reader) SkipToStructEnd() error

SkipToStructEnd for skip to the STRUCT_END tag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL