Documentation ¶
Index ¶
- Variables
- func ReadTo[T io.Reader](bs *ByteStream, reader T) (int64, error)
- func ReadToBuff[T io.Reader](p []byte, reader T) (int64, error)
- func SizeofBool() int
- func SizeofByte() int
- func SizeofBytes(v []byte) int
- func SizeofBytes128() int
- func SizeofBytes16() int
- func SizeofBytes160() int
- func SizeofBytes256() int
- func SizeofBytes32() int
- func SizeofBytes512() int
- func SizeofBytes64() int
- func SizeofDouble() int
- func SizeofFloat() int
- func SizeofInt16() int
- func SizeofInt32() int
- func SizeofInt64() int
- func SizeofInt8() int
- func SizeofString(v string) int
- func SizeofUint16() int
- func SizeofUint32() int
- func SizeofUint64() int
- func SizeofUint8() int
- func SizeofUvarint(v uint64) int
- func SizeofVarint(v int64) int
- type ByteStream
- func (s *ByteStream) BuffRead() []byte
- func (s *ByteStream) BuffUnread() []byte
- func (s *ByteStream) BuffUnwritten() []byte
- func (s *ByteStream) BuffWritten() []byte
- func (s *ByteStream) BytesRead() int
- func (s *ByteStream) BytesUnread() int
- func (s *ByteStream) BytesUnwritten() int
- func (s *ByteStream) BytesWritten() int
- func (s *ByteStream) ReadBool() (bool, error)
- func (s *ByteStream) ReadByte() (byte, error)
- func (s *ByteStream) ReadBytes() ([]byte, error)
- func (s *ByteStream) ReadBytes128() ([128]byte, error)
- func (s *ByteStream) ReadBytes16() ([16]byte, error)
- func (s *ByteStream) ReadBytes160() ([160]byte, error)
- func (s *ByteStream) ReadBytes256() ([256]byte, error)
- func (s *ByteStream) ReadBytes32() ([32]byte, error)
- func (s *ByteStream) ReadBytes512() ([512]byte, error)
- func (s *ByteStream) ReadBytes64() ([64]byte, error)
- func (s *ByteStream) ReadBytesRef() ([]byte, error)
- func (s *ByteStream) ReadDouble() (float64, error)
- func (s *ByteStream) ReadFloat() (float32, error)
- func (s *ByteStream) ReadFrom(reader io.Reader) (int64, error)
- func (s *ByteStream) ReadInt16() (int16, error)
- func (s *ByteStream) ReadInt32() (int32, error)
- func (s *ByteStream) ReadInt64() (int64, error)
- func (s *ByteStream) ReadInt8() (int8, error)
- func (s *ByteStream) ReadString() (string, error)
- func (s *ByteStream) ReadStringRef() (string, error)
- func (s *ByteStream) ReadUint16() (uint16, error)
- func (s *ByteStream) ReadUint32() (uint32, error)
- func (s *ByteStream) ReadUint64() (uint64, error)
- func (s *ByteStream) ReadUint8() (uint8, error)
- func (s *ByteStream) ReadUvarint() (uint64, error)
- func (s *ByteStream) ReadVarint() (int64, error)
- func (s *ByteStream) SeekReadPos(p int) error
- func (s *ByteStream) SeekWritePos(p int) error
- func (s *ByteStream) WriteBool(v bool) error
- func (s *ByteStream) WriteByte(v byte) error
- func (s *ByteStream) WriteBytes(v []byte) error
- func (s *ByteStream) WriteBytes128(v []byte) error
- func (s *ByteStream) WriteBytes16(v []byte) error
- func (s *ByteStream) WriteBytes160(v []byte) error
- func (s *ByteStream) WriteBytes256(v []byte) error
- func (s *ByteStream) WriteBytes32(v []byte) error
- func (s *ByteStream) WriteBytes512(v []byte) error
- func (s *ByteStream) WriteBytes64(v []byte) error
- func (s *ByteStream) WriteDouble(v float64) error
- func (s *ByteStream) WriteFloat(v float32) error
- func (s *ByteStream) WriteInt16(v int16) error
- func (s *ByteStream) WriteInt32(v int32) error
- func (s *ByteStream) WriteInt64(v int64) error
- func (s *ByteStream) WriteInt8(v int8) error
- func (s *ByteStream) WriteString(v string) error
- func (s *ByteStream) WriteTo(writer io.Writer) (int64, error)
- func (s *ByteStream) WriteUint16(v uint16) error
- func (s *ByteStream) WriteUint32(v uint32) error
- func (s *ByteStream) WriteUint64(v uint64) error
- func (s *ByteStream) WriteUint8(v uint8) error
- func (s *ByteStream) WriteUvarint(v uint64) error
- func (s *ByteStream) WriteVarint(v int64) error
- type BytesWriter
- type LimitWriter
- type RecycleBytes
Constants ¶
This section is empty.
Variables ¶
View Source
var BytesPool = bytespool.NewCapacityPools(32, math.MaxInt32)
BytesPool 字节对象池,用于减少GC提高编解码性能
View Source
var ( // ErrInvalidSeekPos 调整的位置无效 ErrInvalidSeekPos = errors.New("invalid seek position") )
View Source
var (
ErrLimitReached = errors.New("i/o limit reached")
)
View Source
var NilRecycleBytes = MakeNonRecycleBytes(nil)
NilRecycleBytes 空字节对象
Functions ¶
func SizeofBool ¶
func SizeofBool() int
func SizeofByte ¶
func SizeofByte() int
func SizeofBytes ¶
func SizeofBytes128 ¶
func SizeofBytes128() int
func SizeofBytes16 ¶
func SizeofBytes16() int
func SizeofBytes160 ¶
func SizeofBytes160() int
func SizeofBytes256 ¶
func SizeofBytes256() int
func SizeofBytes32 ¶
func SizeofBytes32() int
func SizeofBytes512 ¶
func SizeofBytes512() int
func SizeofBytes64 ¶
func SizeofBytes64() int
func SizeofDouble ¶
func SizeofDouble() int
func SizeofFloat ¶
func SizeofFloat() int
func SizeofInt16 ¶
func SizeofInt16() int
func SizeofInt32 ¶
func SizeofInt32() int
func SizeofInt64 ¶
func SizeofInt64() int
func SizeofInt8 ¶
func SizeofInt8() int
func SizeofString ¶
func SizeofUint16 ¶
func SizeofUint16() int
func SizeofUint32 ¶
func SizeofUint32() int
func SizeofUint64 ¶
func SizeofUint64() int
func SizeofUint8 ¶
func SizeofUint8() int
func SizeofUvarint ¶
func SizeofVarint ¶
Types ¶
type ByteStream ¶
type ByteStream struct {
// contains filtered or unexported fields
}
func NewBigEndianStream ¶
func NewBigEndianStream(p []byte) ByteStream
func NewByteStream ¶
func NewByteStream(p []byte, endian binary.ByteOrder) ByteStream
func NewLittleEndianStream ¶
func NewLittleEndianStream(p []byte) ByteStream
func (*ByteStream) BuffRead ¶
func (s *ByteStream) BuffRead() []byte
func (*ByteStream) BuffUnread ¶
func (s *ByteStream) BuffUnread() []byte
func (*ByteStream) BuffUnwritten ¶
func (s *ByteStream) BuffUnwritten() []byte
func (*ByteStream) BuffWritten ¶
func (s *ByteStream) BuffWritten() []byte
func (*ByteStream) BytesRead ¶
func (s *ByteStream) BytesRead() int
func (*ByteStream) BytesUnread ¶
func (s *ByteStream) BytesUnread() int
func (*ByteStream) BytesUnwritten ¶
func (s *ByteStream) BytesUnwritten() int
func (*ByteStream) BytesWritten ¶
func (s *ByteStream) BytesWritten() int
func (*ByteStream) ReadBool ¶
func (s *ByteStream) ReadBool() (bool, error)
func (*ByteStream) ReadByte ¶
func (s *ByteStream) ReadByte() (byte, error)
func (*ByteStream) ReadBytes ¶
func (s *ByteStream) ReadBytes() ([]byte, error)
func (*ByteStream) ReadBytes128 ¶
func (s *ByteStream) ReadBytes128() ([128]byte, error)
func (*ByteStream) ReadBytes16 ¶
func (s *ByteStream) ReadBytes16() ([16]byte, error)
func (*ByteStream) ReadBytes160 ¶
func (s *ByteStream) ReadBytes160() ([160]byte, error)
func (*ByteStream) ReadBytes256 ¶
func (s *ByteStream) ReadBytes256() ([256]byte, error)
func (*ByteStream) ReadBytes32 ¶
func (s *ByteStream) ReadBytes32() ([32]byte, error)
func (*ByteStream) ReadBytes512 ¶
func (s *ByteStream) ReadBytes512() ([512]byte, error)
func (*ByteStream) ReadBytes64 ¶
func (s *ByteStream) ReadBytes64() ([64]byte, error)
func (*ByteStream) ReadBytesRef ¶
func (s *ByteStream) ReadBytesRef() ([]byte, error)
func (*ByteStream) ReadDouble ¶
func (s *ByteStream) ReadDouble() (float64, error)
func (*ByteStream) ReadFloat ¶
func (s *ByteStream) ReadFloat() (float32, error)
func (*ByteStream) ReadInt16 ¶
func (s *ByteStream) ReadInt16() (int16, error)
func (*ByteStream) ReadInt32 ¶
func (s *ByteStream) ReadInt32() (int32, error)
func (*ByteStream) ReadInt64 ¶
func (s *ByteStream) ReadInt64() (int64, error)
func (*ByteStream) ReadInt8 ¶
func (s *ByteStream) ReadInt8() (int8, error)
func (*ByteStream) ReadString ¶
func (s *ByteStream) ReadString() (string, error)
func (*ByteStream) ReadStringRef ¶
func (s *ByteStream) ReadStringRef() (string, error)
func (*ByteStream) ReadUint16 ¶
func (s *ByteStream) ReadUint16() (uint16, error)
func (*ByteStream) ReadUint32 ¶
func (s *ByteStream) ReadUint32() (uint32, error)
func (*ByteStream) ReadUint64 ¶
func (s *ByteStream) ReadUint64() (uint64, error)
func (*ByteStream) ReadUint8 ¶
func (s *ByteStream) ReadUint8() (uint8, error)
func (*ByteStream) ReadUvarint ¶
func (s *ByteStream) ReadUvarint() (uint64, error)
func (*ByteStream) ReadVarint ¶
func (s *ByteStream) ReadVarint() (int64, error)
func (*ByteStream) SeekReadPos ¶
func (s *ByteStream) SeekReadPos(p int) error
func (*ByteStream) SeekWritePos ¶
func (s *ByteStream) SeekWritePos(p int) error
func (*ByteStream) WriteBool ¶
func (s *ByteStream) WriteBool(v bool) error
func (*ByteStream) WriteByte ¶
func (s *ByteStream) WriteByte(v byte) error
func (*ByteStream) WriteBytes ¶
func (s *ByteStream) WriteBytes(v []byte) error
func (*ByteStream) WriteBytes128 ¶
func (s *ByteStream) WriteBytes128(v []byte) error
func (*ByteStream) WriteBytes16 ¶
func (s *ByteStream) WriteBytes16(v []byte) error
func (*ByteStream) WriteBytes160 ¶
func (s *ByteStream) WriteBytes160(v []byte) error
func (*ByteStream) WriteBytes256 ¶
func (s *ByteStream) WriteBytes256(v []byte) error
func (*ByteStream) WriteBytes32 ¶
func (s *ByteStream) WriteBytes32(v []byte) error
func (*ByteStream) WriteBytes512 ¶
func (s *ByteStream) WriteBytes512(v []byte) error
func (*ByteStream) WriteBytes64 ¶
func (s *ByteStream) WriteBytes64(v []byte) error
func (*ByteStream) WriteDouble ¶
func (s *ByteStream) WriteDouble(v float64) error
func (*ByteStream) WriteFloat ¶
func (s *ByteStream) WriteFloat(v float32) error
func (*ByteStream) WriteInt16 ¶
func (s *ByteStream) WriteInt16(v int16) error
func (*ByteStream) WriteInt32 ¶
func (s *ByteStream) WriteInt32(v int32) error
func (*ByteStream) WriteInt64 ¶
func (s *ByteStream) WriteInt64(v int64) error
func (*ByteStream) WriteInt8 ¶
func (s *ByteStream) WriteInt8(v int8) error
func (*ByteStream) WriteString ¶
func (s *ByteStream) WriteString(v string) error
func (*ByteStream) WriteUint16 ¶
func (s *ByteStream) WriteUint16(v uint16) error
func (*ByteStream) WriteUint32 ¶
func (s *ByteStream) WriteUint32(v uint32) error
func (*ByteStream) WriteUint64 ¶
func (s *ByteStream) WriteUint64(v uint64) error
func (*ByteStream) WriteUint8 ¶
func (s *ByteStream) WriteUint8(v uint8) error
func (*ByteStream) WriteUvarint ¶
func (s *ByteStream) WriteUvarint(v uint64) error
func (*ByteStream) WriteVarint ¶
func (s *ByteStream) WriteVarint(v int64) error
type BytesWriter ¶
BytesWriter will only write bytes to the underlying writer until the limit is reached.
func NewBytesWriter ¶
func NewBytesWriter(bs []byte) *BytesWriter
NewBytesWriter creates a new instance of BytesWriter.
type LimitWriter ¶
LimitWriter will only write bytes to the underlying writer until the limit is reached.
func NewLimitWriter ¶
func NewLimitWriter(w io.Writer, n int) *LimitWriter
NewLimitWriter creates a new instance of LimitWriter.
type RecycleBytes ¶
type RecycleBytes struct {
// contains filtered or unexported fields
}
RecycleBytes 可回收字节对象
func CloneRecycleBytes ¶ added in v0.2.17
func CloneRecycleBytes(bs []byte) RecycleBytes
CloneRecycleBytes 克隆并创建可回收字节对象
func MakeNonRecycleBytes ¶
func MakeNonRecycleBytes(bs []byte) RecycleBytes
MakeNonRecycleBytes 创建不可回收字节对象
func (RecycleBytes) Equal ¶ added in v0.2.17
func (b RecycleBytes) Equal(other RecycleBytes) bool
Equal 是否是相同
func (RecycleBytes) Slice ¶ added in v0.2.17
func (b RecycleBytes) Slice(low, high int) RecycleBytes
Slice 切片
Click to show internal directories.
Click to hide internal directories.