Documentation ¶
Index ¶
- Constants
- Variables
- type Parser
- func (p *Parser) ParseInt16(b []byte) int16
- func (p *Parser) ParseInt32(b []byte) int32
- func (p *Parser) ParseInt64(b []byte) int64
- func (p *Parser) ParseInt8(b []byte) int8
- func (p *Parser) ParseUint16(b []byte) uint16
- func (p *Parser) ParseUint32(b []byte) uint32
- func (p *Parser) ParseUint64(b []byte) uint64
- func (p *Parser) ParseUint8(b []byte) uint8
- type ProtocolError
- type ReadBuffer
- func (rb *ReadBuffer) Buffered() int
- func (rb *ReadBuffer) DiscardN(n int) error
- func (rb *ReadBuffer) Done() bool
- func (rb *ReadBuffer) Peek(n int) ([]byte, error)
- func (rb *ReadBuffer) ReadMessage(size int64) ([]byte, error)
- func (rb *ReadBuffer) ReadN(n int, f func([]byte)) error
- func (rb *ReadBuffer) ReadUint16(v *uint16) error
- func (rb *ReadBuffer) ReadUint32(v *uint32) error
- func (rb *ReadBuffer) ReadUint64(v *uint64) error
- func (rb *ReadBuffer) ReadUint8(v *uint8) error
- func (rb *ReadBuffer) ReadVarString(size uint64) (string, error)
- func (rb *ReadBuffer) ReadVarUInt(v *uint64) (remain int, err error)
- func (rb *ReadBuffer) Remaining() int
- func (rb *ReadBuffer) Reset(r io.Reader)
- func (rb *ReadBuffer) SnappyReader() *snappy.Reader
- type WriteBuffer
- func (wb *WriteBuffer) Flush() error
- func (wb *WriteBuffer) Reset(w io.Writer)
- func (wb *WriteBuffer) Write(b []byte) (int, error)
- func (wb *WriteBuffer) WriteString(s string) error
- func (wb *WriteBuffer) WriteString8(s string) error
- func (wb *WriteBuffer) WriteUint16(i uint16) error
- func (wb *WriteBuffer) WriteUint32(i uint32) error
- func (wb *WriteBuffer) WriteUint64(i uint64) error
- func (wb *WriteBuffer) WriteUint8(i uint8) error
Constants ¶
View Source
const ( SizeOfUint8Bytes = 1 SizeOfUint16Bytes = 2 SizeOfUint32Bytes = 4 SizeOfUint64Bytes = 8 SizeOfInt8Bytes = 1 SizeOfInt16Bytes = 2 SizeOfInt32Bytes = 4 SizeOfInt64Bytes = 8 )
Numbers' bytes size.
Variables ¶
View Source
var ( ErrNotEnoughBytes = NewProtocolError(nil, "not enough bytes available") ErrNotEnoughBytesWrite = NewProtocolError(nil, "not enough bytes available in buffer to write") )
errors of parsing.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser struct.
func (*Parser) ParseInt16 ¶
func (*Parser) ParseInt32 ¶
func (*Parser) ParseInt64 ¶
func (*Parser) ParseUint16 ¶
func (*Parser) ParseUint32 ¶
func (*Parser) ParseUint64 ¶
func (*Parser) ParseUint8 ¶
type ProtocolError ¶
type ProtocolError struct {
// contains filtered or unexported fields
}
ProtocolError represents errors during protocol io.
func NewProtocolError ¶
func NewProtocolError(inner error, msg string) *ProtocolError
NewProtocolError constructs a protocol error.
type ReadBuffer ¶
type ReadBuffer struct { Parser Parser // contains filtered or unexported fields }
ReadBuffer struct.
func NewReadBuffer ¶
NewReadBuffer constructor.
func (*ReadBuffer) Buffered ¶
func (rb *ReadBuffer) Buffered() int
func (*ReadBuffer) DiscardN ¶
func (rb *ReadBuffer) DiscardN(n int) error
func (*ReadBuffer) Done ¶
func (rb *ReadBuffer) Done() bool
func (*ReadBuffer) ReadMessage ¶
func (rb *ReadBuffer) ReadMessage(size int64) ([]byte, error)
func (*ReadBuffer) ReadUint16 ¶
func (rb *ReadBuffer) ReadUint16(v *uint16) error
func (*ReadBuffer) ReadUint32 ¶
func (rb *ReadBuffer) ReadUint32(v *uint32) error
func (*ReadBuffer) ReadUint64 ¶
func (rb *ReadBuffer) ReadUint64(v *uint64) error
func (*ReadBuffer) ReadUint8 ¶
func (rb *ReadBuffer) ReadUint8(v *uint8) error
func (*ReadBuffer) ReadVarString ¶
func (rb *ReadBuffer) ReadVarString(size uint64) (string, error)
func (*ReadBuffer) ReadVarUInt ¶
func (rb *ReadBuffer) ReadVarUInt(v *uint64) (remain int, err error)
func (*ReadBuffer) Remaining ¶
func (rb *ReadBuffer) Remaining() int
func (*ReadBuffer) Reset ¶
func (rb *ReadBuffer) Reset(r io.Reader)
func (*ReadBuffer) SnappyReader ¶
func (rb *ReadBuffer) SnappyReader() *snappy.Reader
type WriteBuffer ¶
WriteBuffer struct.
func NewWriteBuffer ¶
func NewWriteBuffer(w io.Writer, binaryEndianness binary.ByteOrder) WriteBuffer
NewWriteBuffer constructor.
func (*WriteBuffer) Flush ¶
func (wb *WriteBuffer) Flush() error
func (*WriteBuffer) Reset ¶
func (wb *WriteBuffer) Reset(w io.Writer)
func (*WriteBuffer) WriteString ¶
func (wb *WriteBuffer) WriteString(s string) error
func (*WriteBuffer) WriteString8 ¶
func (wb *WriteBuffer) WriteString8(s string) error
func (*WriteBuffer) WriteUint16 ¶
func (wb *WriteBuffer) WriteUint16(i uint16) error
func (*WriteBuffer) WriteUint32 ¶
func (wb *WriteBuffer) WriteUint32(i uint32) error
func (*WriteBuffer) WriteUint64 ¶
func (wb *WriteBuffer) WriteUint64(i uint64) error
func (*WriteBuffer) WriteUint8 ¶
func (wb *WriteBuffer) WriteUint8(i uint8) error
Click to show internal directories.
Click to hide internal directories.