marshalutil

package
v1.0.0-beta24 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0, BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BOOL_SIZE = 1
View Source
const INT64_SIZE = 8
View Source
const TIME_SIZE = INT64_SIZE
View Source
const UINT16_SIZE = 4
View Source
const UINT32_SIZE = 4
View Source
const UINT64_SIZE = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type MarshalUtil

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

func New

func New(args ...interface{}) *MarshalUtil

func (*MarshalUtil) Bytes

func (util *MarshalUtil) Bytes(clone ...bool) []byte

func (*MarshalUtil) Parse

func (util *MarshalUtil) Parse(parser func(data []byte) (interface{}, int, error)) (result interface{}, err error)

func (*MarshalUtil) ReadBool

func (util *MarshalUtil) ReadBool() (bool, error)

func (*MarshalUtil) ReadByte

func (util *MarshalUtil) ReadByte() (byte, error)

func (*MarshalUtil) ReadBytes

func (util *MarshalUtil) ReadBytes(length int, optionalReadOffset ...int) ([]byte, error)

ReadBytes unmarshals the given amount of bytes from the internal read buffer and advances the read offset. If an optionalReadOffset parameter is provided, then the method does not modify the read offset but instead just returns a copy of the bytes in the provided range.

func (*MarshalUtil) ReadInt64

func (util *MarshalUtil) ReadInt64() (int64, error)

func (*MarshalUtil) ReadOffset

func (util *MarshalUtil) ReadOffset() int

func (*MarshalUtil) ReadRemainingBytes

func (util *MarshalUtil) ReadRemainingBytes() []byte

func (*MarshalUtil) ReadSeek

func (util *MarshalUtil) ReadSeek(offset int)

func (*MarshalUtil) ReadTime

func (util *MarshalUtil) ReadTime() (result time.Time, err error)

ReadTime unmarshals a time object from the internal read buffer.

func (*MarshalUtil) ReadUint16

func (util *MarshalUtil) ReadUint16() (uint16, error)

func (*MarshalUtil) ReadUint32

func (util *MarshalUtil) ReadUint32() (uint32, error)

func (*MarshalUtil) ReadUint64

func (util *MarshalUtil) ReadUint64() (uint64, error)

func (*MarshalUtil) WriteBool

func (util *MarshalUtil) WriteBool(bool bool) *MarshalUtil

func (*MarshalUtil) WriteByte

func (util *MarshalUtil) WriteByte(byte byte) *MarshalUtil

func (*MarshalUtil) WriteBytes

func (util *MarshalUtil) WriteBytes(bytes []byte) *MarshalUtil

WriteBytes appends the given bytes to the internal buffer. It returns the same MarshalUtil so calls can be chained.

func (*MarshalUtil) WriteInt64

func (util *MarshalUtil) WriteInt64(value int64) *MarshalUtil

func (*MarshalUtil) WriteOffset

func (util *MarshalUtil) WriteOffset() int

func (*MarshalUtil) WriteSeek

func (util *MarshalUtil) WriteSeek(offset int)

func (*MarshalUtil) WriteTime

func (util *MarshalUtil) WriteTime(timeToWrite time.Time) *MarshalUtil

WriteTime marshals the given time into a sequence of bytes, that get appended to the internal buffer.

func (*MarshalUtil) WriteUint16

func (util *MarshalUtil) WriteUint16(value uint16) *MarshalUtil

func (*MarshalUtil) WriteUint32

func (util *MarshalUtil) WriteUint32(value uint32) *MarshalUtil

func (*MarshalUtil) WriteUint64

func (util *MarshalUtil) WriteUint64(value uint64) *MarshalUtil

Jump to

Keyboard shortcuts

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