marshalutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0, BSD-2-Clause Imports: 3 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 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) ([]byte, error)

ReadBytes unmarshals the given amount of bytes from the internal read buffer.

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) 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) 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