Documentation
¶
Index ¶
- Variables
- func FindCRIterator(b byte) bool
- func FindCRLFIterator(b byte) bool
- func FindLFIterator(b byte) bool
- func FindNotCRIterator(b byte) bool
- func FindNotCRLFIterator(b byte) bool
- func FindNotLFIterator(b byte) bool
- func FindNotNullIterator(b byte) bool
- func FindNotWhiteSpaceIterator(b byte) bool
- func FindNullIterator(b byte) bool
- func FindWhiteSpaceIterator(b byte) bool
- type ByteBuf
- func (b *ByteBuf) AvailableBytes() []byte
- func (b *ByteBuf) Bytes() []byte
- func (b *ByteBuf) Capacity() int
- func (b *ByteBuf) Copy() *ByteBuf
- func (b *ByteBuf) DiscardReadBytes()
- func (b *ByteBuf) EnsureCapacity(size int)
- func (b *ByteBuf) Equal(ob *ByteBuf) bool
- func (b *ByteBuf) Flush()
- func (b *ByteBuf) ForEachByte(iterator ByteIterator, indexes ...int) int
- func (b *ByteBuf) ForceRelease()
- func (b *ByteBuf) GetBool(i int) (bool, error)
- func (b *ByteBuf) GetByte(i int) (byte, error)
- func (b *ByteBuf) GetBytes(p []byte, start int, indexes ...int) (int, error)
- func (b *ByteBuf) GetFloat32BE(i int) (float32, error)
- func (b *ByteBuf) GetFloat32LE(i int) (float32, error)
- func (b *ByteBuf) GetFloat64BE(i int) (float64, error)
- func (b *ByteBuf) GetFloat64LE(i int) (float64, error)
- func (b *ByteBuf) GetInt16BE(i int) (int16, error)
- func (b *ByteBuf) GetInt16LE(i int) (int16, error)
- func (b *ByteBuf) GetInt32BE(i int) (int32, error)
- func (b *ByteBuf) GetInt32LE(i int) (int32, error)
- func (b *ByteBuf) GetInt64BE(i int) (int64, error)
- func (b *ByteBuf) GetInt64LE(i int) (int64, error)
- func (b *ByteBuf) GetInt8(i int) (int8, error)
- func (b *ByteBuf) GetUInt16BE(i int) (uint16, error)
- func (b *ByteBuf) GetUInt16LE(i int) (uint16, error)
- func (b *ByteBuf) GetUInt32BE(i int) (uint32, error)
- func (b *ByteBuf) GetUInt32LE(i int) (uint32, error)
- func (b *ByteBuf) GetUInt64BE(i int) (uint64, error)
- func (b *ByteBuf) GetUInt64LE(i int) (uint64, error)
- func (b *ByteBuf) GetUInt8(i int) (uint8, error)
- func (b *ByteBuf) Index(p []byte, indexes ...int) int
- func (b *ByteBuf) IsReadable() bool
- func (b *ByteBuf) MarkReaderIndex()
- func (b *ByteBuf) MarkWriterIndex()
- func (b *ByteBuf) PutBool(i int, val bool) error
- func (b *ByteBuf) PutByte(i int, val byte) error
- func (b *ByteBuf) PutBytes(i int, p []byte) error
- func (b *ByteBuf) PutFloat32BE(i int, val float32) error
- func (b *ByteBuf) PutFloat32LE(i int, val float32) error
- func (b *ByteBuf) PutFloat64BE(i int, val float64) error
- func (b *ByteBuf) PutFloat64LE(i int, val float64) error
- func (b *ByteBuf) PutInt16BE(i int, val int16) error
- func (b *ByteBuf) PutInt16LE(i int, val int16) error
- func (b *ByteBuf) PutInt32BE(i int, val int32) error
- func (b *ByteBuf) PutInt32LE(i int, val int32) error
- func (b *ByteBuf) PutInt64BE(i int, val int64) error
- func (b *ByteBuf) PutInt64LE(i int, val int64) error
- func (b *ByteBuf) PutInt8(i int, val int8) error
- func (b *ByteBuf) PutUInt16BE(i int, val uint16) error
- func (b *ByteBuf) PutUInt16LE(i int, val uint16) error
- func (b *ByteBuf) PutUInt32BE(i int, val uint32) error
- func (b *ByteBuf) PutUInt32LE(i int, val uint32) error
- func (b *ByteBuf) PutUInt64BE(i int, val uint64) error
- func (b *ByteBuf) PutUInt64LE(i int, val uint64) error
- func (b *ByteBuf) PutUInt8(i int, val uint8) error
- func (b *ByteBuf) Read(p []byte) (int, error)
- func (b *ByteBuf) ReadBool() (bool, error)
- func (b *ByteBuf) ReadByte() (byte, error)
- func (b *ByteBuf) ReadByteBuf(size int) (*ByteBuf, error)
- func (b *ByteBuf) ReadBytes(p []byte) (int, error)
- func (b *ByteBuf) ReadFloat32BE() (float32, error)
- func (b *ByteBuf) ReadFloat32LE() (float32, error)
- func (b *ByteBuf) ReadFloat64BE() (float64, error)
- func (b *ByteBuf) ReadFloat64LE() (float64, error)
- func (b *ByteBuf) ReadFrom(reader io.Reader) error
- func (b *ByteBuf) ReadInt16BE() (int16, error)
- func (b *ByteBuf) ReadInt16LE() (int16, error)
- func (b *ByteBuf) ReadInt32BE() (int32, error)
- func (b *ByteBuf) ReadInt32LE() (int32, error)
- func (b *ByteBuf) ReadInt64BE() (int64, error)
- func (b *ByteBuf) ReadInt64LE() (int64, error)
- func (b *ByteBuf) ReadInt8() (int8, error)
- func (b *ByteBuf) ReadUInt16BE() (uint16, error)
- func (b *ByteBuf) ReadUInt16LE() (uint16, error)
- func (b *ByteBuf) ReadUInt32BE() (uint32, error)
- func (b *ByteBuf) ReadUInt32LE() (uint32, error)
- func (b *ByteBuf) ReadUInt64BE() (uint64, error)
- func (b *ByteBuf) ReadUInt64LE() (uint64, error)
- func (b *ByteBuf) ReadUInt8() (uint8, error)
- func (b *ByteBuf) ReadableBytes() int
- func (b *ByteBuf) ReaderIndex() int
- func (b *ByteBuf) Ref()
- func (b *ByteBuf) Release()
- func (b *ByteBuf) ResetReaderIndex()
- func (b *ByteBuf) ResetWriterIndex()
- func (b *ByteBuf) Size() int
- func (b *ByteBuf) Skip(size int) error
- func (b *ByteBuf) String() string
- func (b *ByteBuf) UnsafeBytes() []byte
- func (b *ByteBuf) Write(p []byte) (int, error)
- func (b *ByteBuf) WriteBool(val bool) error
- func (b *ByteBuf) WriteByte(val byte) error
- func (b *ByteBuf) WriteByteBuf(buf ByteBuf) error
- func (b *ByteBuf) WriteBytes(p []byte) error
- func (b *ByteBuf) WriteFloat32BE(val float32) error
- func (b *ByteBuf) WriteFloat32LE(val float32) error
- func (b *ByteBuf) WriteFloat64BE(val float64) error
- func (b *ByteBuf) WriteFloat64LE(val float64) error
- func (b *ByteBuf) WriteInt16BE(val int16) error
- func (b *ByteBuf) WriteInt16LE(val int16) error
- func (b *ByteBuf) WriteInt32BE(val int32) error
- func (b *ByteBuf) WriteInt32LE(val int32) error
- func (b *ByteBuf) WriteInt64BE(val int64) error
- func (b *ByteBuf) WriteInt64LE(val int64) error
- func (b *ByteBuf) WriteInt8(val int8) error
- func (b *ByteBuf) WriteTo(writer io.Writer) (int64, error)
- func (b *ByteBuf) WriteUInt16BE(val uint16) error
- func (b *ByteBuf) WriteUInt16LE(val uint16) error
- func (b *ByteBuf) WriteUInt32BE(val uint32) error
- func (b *ByteBuf) WriteUInt32LE(val uint32) error
- func (b *ByteBuf) WriteUInt64BE(val uint64) error
- func (b *ByteBuf) WriteUInt64LE(val uint64) error
- func (b *ByteBuf) WriteUInt8(val uint8) error
- func (b *ByteBuf) WriterIndex() int
- type ByteIterator
Constants ¶
This section is empty.
Variables ¶
var (
// ChunkSize how much byte to allocate if there were not enough room
ChunkSize = 1024
)
Global parameters, users can modify accordingly
var (
ErrOutOfBound = errors.New("index is out of bound")
)
Errors
Functions ¶
func FindNotCRLFIterator ¶
FindNotCRLFIterator find till not \r or \n
func FindNotNullIterator ¶
FindNotNullIterator find till not null
func FindNotWhiteSpaceIterator ¶
FindNotWhiteSpaceIterator fdin till \s \t \r\ n
func FindWhiteSpaceIterator ¶
FindWhiteSpaceIterator fdin till \s \t \r\ n
Types ¶
type ByteBuf ¶
type ByteBuf struct {
// contains filtered or unexported fields
}
ByteBuf ByteBuf itself
func NewByteBuf ¶
NewByteBuf create new ByteBuf, pass any []byte in as initial buffer, it will be auto capped
func (*ByteBuf) AvailableBytes ¶
AvailableBytes get available bytes([:size])
func (*ByteBuf) DiscardReadBytes ¶
func (b *ByteBuf) DiscardReadBytes()
DiscardReadBytes discard bytes that are read, adjust readerIndex/writerIndex accordingly
func (*ByteBuf) EnsureCapacity ¶
EnsureCapacity allocate more bytes to ensure the capacity
func (*ByteBuf) Equal ¶
Equal if current ByteBuf is equal to another ByteBuf, compared by underlying byte slice
func (*ByteBuf) ForEachByte ¶
func (b *ByteBuf) ForEachByte(iterator ByteIterator, indexes ...int) int
ForEachByte iterate through readable bytes, ForEachByte(iterator, start), ForEachByte(iterator, start, end)
func (*ByteBuf) GetBytes ¶
GetBytes get bytes at given position, GetBytes(p, start), GetBytes(p, start, end)
func (*ByteBuf) GetFloat32BE ¶
GetFloat32BE get a float32 in big endian at given position
func (*ByteBuf) GetFloat32LE ¶
GetFloat32LE get a float32 in little endian at given position
func (*ByteBuf) GetFloat64BE ¶
GetFloat64BE get a float64 in big endian at given position
func (*ByteBuf) GetFloat64LE ¶
GetFloat64LE get a float64 in little endian at given position
func (*ByteBuf) GetInt16BE ¶
GetInt16BE get an int16 in big endian at given position
func (*ByteBuf) GetInt16LE ¶
GetInt16LE get an int16 in little endian at given position
func (*ByteBuf) GetInt32BE ¶
GetInt32BE get an int32 in big endian at given position
func (*ByteBuf) GetInt32LE ¶
GetInt32LE get an int32 in little endian at given position
func (*ByteBuf) GetInt64BE ¶
GetInt64BE get a int64 in big endian at given position
func (*ByteBuf) GetInt64LE ¶
GetInt64LE get a int64 in little endian at given position
func (*ByteBuf) GetUInt16BE ¶
GetUInt16BE get an uint16 in big endian at given position
func (*ByteBuf) GetUInt16LE ¶
GetUInt16LE get an uint16 in little endian at given position
func (*ByteBuf) GetUInt32BE ¶
GetUInt32BE get an uint32 in big endian at given position
func (*ByteBuf) GetUInt32LE ¶
GetUInt32LE get an uint32 in little endian at given position
func (*ByteBuf) GetUInt64BE ¶
GetUInt64BE get an uint64 in big endian at given position
func (*ByteBuf) GetUInt64LE ¶
GetUInt64LE get an uint64 in little endian at given position
func (*ByteBuf) Index ¶
Index index a byte slice inside buffer, Index(p), Index(p, start), Index(p, start, end)
func (*ByteBuf) IsReadable ¶
IsReadable if buf is readable (b.writerIndex > b.readerIndex)
func (*ByteBuf) MarkReaderIndex ¶
func (b *ByteBuf) MarkReaderIndex()
MarkReaderIndex mark current reader index for reset in the future
func (*ByteBuf) MarkWriterIndex ¶
func (b *ByteBuf) MarkWriterIndex()
MarkWriterIndex mark current writer index for reset in the future
func (*ByteBuf) PutFloat32BE ¶
PutFloat32BE put a float32 at given position in big endian
func (*ByteBuf) PutFloat32LE ¶
PutFloat32LE put a float32 at given position in little endian
func (*ByteBuf) PutFloat64BE ¶
PutFloat64BE put a float64 at given position in big endian
func (*ByteBuf) PutFloat64LE ¶
PutFloat64LE put a float64 at given position in little endian
func (*ByteBuf) PutInt16BE ¶
PutInt16BE put an int16 at given position in big endian
func (*ByteBuf) PutInt16LE ¶
PutInt16LE put an int16 at given position in little endian
func (*ByteBuf) PutInt32BE ¶
PutInt32BE put an int32 at given position in big endian
func (*ByteBuf) PutInt32LE ¶
PutInt32LE put an int32 at given position in little endian
func (*ByteBuf) PutInt64BE ¶
PutInt64BE put an int64 at given position in big endian
func (*ByteBuf) PutInt64LE ¶
PutInt64LE put an int64 at given position in little endian
func (*ByteBuf) PutUInt16BE ¶
PutUInt16BE put an uint16 at given position in big endian
func (*ByteBuf) PutUInt16LE ¶
PutUInt16LE put an uint16 at given position in little endian
func (*ByteBuf) PutUInt32BE ¶
PutUInt32BE put an uint32 at given position in big endian
func (*ByteBuf) PutUInt32LE ¶
PutUInt32LE put an uint32 at given position in little endian
func (*ByteBuf) PutUInt64BE ¶
PutUInt64BE put an uint64 at given position in big endian
func (*ByteBuf) PutUInt64LE ¶
PutUInt64LE put an uint64 at given position in little endian
func (*ByteBuf) ReadByteBuf ¶
ReadByteBuf read bytes with given size into a new ByteBuf
func (*ByteBuf) ReadFloat32BE ¶
ReadFloat32BE read a float32 in big endian
func (*ByteBuf) ReadFloat32LE ¶
ReadFloat32LE read a float32 in little endian
func (*ByteBuf) ReadFloat64BE ¶
ReadFloat64BE read a float64 in big endian
func (*ByteBuf) ReadFloat64LE ¶
ReadFloat64LE read a float64 in little endian
func (*ByteBuf) ReadInt16BE ¶
ReadInt16BE read an int16 in big endian
func (*ByteBuf) ReadInt16LE ¶
ReadInt16LE read an int16 in little endian
func (*ByteBuf) ReadInt32BE ¶
ReadInt32BE read an int32 in big endian
func (*ByteBuf) ReadInt32LE ¶
ReadInt32LE read an int32 in little endian
func (*ByteBuf) ReadInt64BE ¶
ReadInt64BE read an int64 in big endian
func (*ByteBuf) ReadInt64LE ¶
ReadInt64LE read an int64 in little endian
func (*ByteBuf) ReadUInt16BE ¶
ReadUInt16BE read a uint16 in big endian
func (*ByteBuf) ReadUInt16LE ¶
ReadUInt16LE read a uint16 in little endian
func (*ByteBuf) ReadUInt32BE ¶
ReadUInt32BE read a uint32 in big endian
func (*ByteBuf) ReadUInt32LE ¶
ReadUInt32LE read a uint32 in little endian
func (*ByteBuf) ReadUInt64BE ¶
ReadUInt64BE read a uint64 in big endian
func (*ByteBuf) ReadUInt64LE ¶
ReadUInt64LE read a uint64 in little endian
func (*ByteBuf) ReadableBytes ¶
ReadableBytes how much bytes are there to be read
func (*ByteBuf) ReaderIndex ¶
ReaderIndex access current reader index
func (*ByteBuf) Release ¶
func (b *ByteBuf) Release()
Release decrement reference counter, underlying buf will be cleared once reference count is 0
func (*ByteBuf) ResetReaderIndex ¶
func (b *ByteBuf) ResetReaderIndex()
ResetReaderIndex reset reader index to marked index
func (*ByteBuf) ResetWriterIndex ¶
func (b *ByteBuf) ResetWriterIndex()
ResetWriterIndex reset writer index to marked index
func (*ByteBuf) UnsafeBytes ¶
UnsafeBytes DANGER! access underlying buffer directly
func (*ByteBuf) WriteByteBuf ¶
func (*ByteBuf) WriteFloat32BE ¶
WriteFloat32BE write a float32 in big endian
func (*ByteBuf) WriteFloat32LE ¶
WriteFloat32LE write a float32 in little endian
func (*ByteBuf) WriteFloat64BE ¶
WriteFloat64BE write a float64 in big endian
func (*ByteBuf) WriteFloat64LE ¶
WriteFloat64LE write a float64 in little endian
func (*ByteBuf) WriteInt16BE ¶
WriteInt16BE write an int16 in big endian
func (*ByteBuf) WriteInt16LE ¶
WriteInt16LE write an int16 in little endian
func (*ByteBuf) WriteInt32BE ¶
WriteInt32BE write an int32 in big endian
func (*ByteBuf) WriteInt32LE ¶
WriteInt32LE write an int32 in little endian
func (*ByteBuf) WriteInt64BE ¶
WriteInt64BE write an int64 in big endian
func (*ByteBuf) WriteInt64LE ¶
WriteInt64LE write an int64 in little endian
func (*ByteBuf) WriteUInt16BE ¶
WriteUInt16BE write an uint16 in big endian
func (*ByteBuf) WriteUInt16LE ¶
WriteUInt16LE write an uint16 in little endian
func (*ByteBuf) WriteUInt32BE ¶
WriteUInt32BE write an uint32 in big endian
func (*ByteBuf) WriteUInt32LE ¶
WriteUInt32LE write an uint32 in little endian
func (*ByteBuf) WriteUInt64BE ¶
WriteUInt64BE write an uint64 in big endian
func (*ByteBuf) WriteUInt64LE ¶
WriteUInt64LE write an uint64 in little endian
func (*ByteBuf) WriteUInt8 ¶
WriteUInt8 write an uint8
func (*ByteBuf) WriterIndex ¶
WriterIndex access current writer index