Documentation ¶
Index ¶
- Variables
- func NumberFromBytesBigEndian(buf []byte) uint64
- func NumberFromBytesLittleEndian(buf []byte) uint64
- type BinReader
- func (r *BinReader) Empty() bool
- func (r *BinReader) End()
- func (r *BinReader) LeftBytes() []byte
- func (r *BinReader) ReadBytes(sz int) ([]byte, error)
- func (r *BinReader) ReadBytesUntilTerm() ([]byte, error)
- func (r *BinReader) ReadEOFString() (string, error)
- func (r *BinReader) ReadInt16() (int16, error)
- func (r *BinReader) ReadInt24() (int32, error)
- func (r *BinReader) ReadInt32() (int32, error)
- func (r *BinReader) ReadInt64() (int64, error)
- func (r *BinReader) ReadInt8() (int8, error)
- func (r *BinReader) ReadLenString() (string, error)
- func (r *BinReader) ReadLenencBytes() ([]byte, error)
- func (r *BinReader) ReadLenencInt() (uint64, error)
- func (r *BinReader) ReadLenencString() (string, error)
- func (r *BinReader) ReadStringUntilTerm() (string, error)
- func (r *BinReader) ReadStringWithLen(l int) (string, error)
- func (r *BinReader) ReadUint16() (uint16, error)
- func (r *BinReader) ReadUint24() (uint32, error)
- func (r *BinReader) ReadUint32() (uint32, error)
- func (r *BinReader) ReadUint48() (uint64, error)
- func (r *BinReader) ReadUint64() (uint64, error)
- func (r *BinReader) ReadUint8() (uint8, error)
- type BinWriter
- func (w *BinWriter) Bytes() []byte
- func (w *BinWriter) End()
- func (w *BinWriter) WriteBytes(data []byte) error
- func (w *BinWriter) WriteEOFString(s string) error
- func (w *BinWriter) WriteInt16(v int16) error
- func (w *BinWriter) WriteInt32(v int32) error
- func (w *BinWriter) WriteInt64(v int64) error
- func (w *BinWriter) WriteInt8(v int8) error
- func (w *BinWriter) WriteLenBytes(data []byte) error
- func (w *BinWriter) WriteLenString(s string) error
- func (w *BinWriter) WriteStringWithTerm(s string) error
- func (w *BinWriter) WriteUint16(v uint16) error
- func (w *BinWriter) WriteUint32(v uint32) error
- func (w *BinWriter) WriteUint64(v uint64) error
- func (w *BinWriter) WriteUint8(v uint8) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrBinaryEventOverflow = errors.New("Binary event data overflow")
)
Parse errors
Functions ¶
func NumberFromBytesBigEndian ¶
NumberFromBytesBigEndian parses the buf by big endian order
func NumberFromBytesLittleEndian ¶
NumberFromBytesLittleEndian parses the buf by little endian order
Types ¶
type BinReader ¶
type BinReader struct {
// contains filtered or unexported fields
}
BinReader reads values from the binary data
func (*BinReader) ReadBytesUntilTerm ¶
ReadBytesUntilTerm read the buffer bytes until meet terminate byte(0)
func (*BinReader) ReadEOFString ¶
ReadEOFString reads string with eof from the buffer
func (*BinReader) ReadLenString ¶
ReadLenString reads length string from the buffer
func (*BinReader) ReadLenencBytes ¶
ReadLenencBytes reads the lenenc bytes from the buffer
func (*BinReader) ReadLenencInt ¶
ReadLenencInt reads the lenenc int from the buffer
func (*BinReader) ReadLenencString ¶
ReadLenencString reads the lenenc string from the buffer
func (*BinReader) ReadStringUntilTerm ¶
ReadStringUntilTerm read the buffer bytes until meet terminate byte(0)
func (*BinReader) ReadStringWithLen ¶
ReadStringWithLen reads string with given length
func (*BinReader) ReadUint16 ¶
ReadUint16 reads uint16 from the buffer
func (*BinReader) ReadUint24 ¶
ReadUint24 reads the next 3 bytes as the uint32 number
func (*BinReader) ReadUint32 ¶
ReadUint32 reads uint32 from the buffer
func (*BinReader) ReadUint48 ¶
ReadUint48 reads uint48 from the buffer
func (*BinReader) ReadUint64 ¶
ReadUint64 reads uint64 from the buffer
type BinWriter ¶
type BinWriter struct {
// contains filtered or unexported fields
}
BinWriter writes value to binary buffer
func (*BinWriter) WriteBytes ¶
WriteBytes write bytes to the buffer
func (*BinWriter) WriteEOFString ¶
WriteEOFString write bytes to the buffer
func (*BinWriter) WriteInt16 ¶
WriteInt16 writes int16 to the buffer
func (*BinWriter) WriteInt32 ¶
WriteInt32 writes int32 to the buffer
func (*BinWriter) WriteInt64 ¶
WriteInt64 writes int64 to the buffer
func (*BinWriter) WriteLenBytes ¶
WriteLenBytes writes byte slice with length as prefix
func (*BinWriter) WriteLenString ¶
WriteLenString writes a string with length as prefix
func (*BinWriter) WriteStringWithTerm ¶
WriteStringWithTerm writes a string with '\0' terminate
func (*BinWriter) WriteUint16 ¶
WriteUint16 writes uint16 to the buffer
func (*BinWriter) WriteUint32 ¶
WriteUint32 writes uint32 to the buffer
func (*BinWriter) WriteUint64 ¶
WriteUint64 writes uint64 to the buffer
func (*BinWriter) WriteUint8 ¶
WriteUint8 writes uint8 to the buffer