Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
func NewBaseBuffer ¶
type RReader ¶ added in v1.5.6
type RReader interface { IsCanGrow() bool GetCapacity() int // 获取总空间大小 GetDataSize() int // 获取占用的数据空间大小 GetTailSize() int // 获取尾部空间大小 GetEmptySize() int // 获取空余总空间大小 IsEmpty() bool io.Reader Peek() (first, end []byte) //查看,但不取出数据 PeekLen(outLen int) (first, end []byte) PeekOut() (first, end []byte) //取出数据,但不做数据拷贝,有数据被覆盖风险 PeekOutLen(outLen int) (first, end []byte, err error) CopyOut(out []byte) int // 读取最大out长度的数据,返回读出数据长度 CopyOutLen(out []byte, outLen int) error // 读取outLen长度的数据,如果数据不足 outLen 返回 error }
type Reader ¶ added in v1.1.5
type Reader interface { IsCanGrow() bool GetCapacity() int // 获取总空间大小 GetDataSize() int // 获取占用的数据空间大小 GetTailSize() int // 获取尾部空间大小 GetEmptySize() int // 获取空余总空间大小 IsEmpty() bool io.Reader Peek() []byte //查看,但不取出数据 PeekLen(outLen int) []byte PeekOut() []byte //取出数据,但不做数据拷贝,有数据被覆盖风险 PeekOutLen(outLen int) ([]byte, error) CopyOut(out []byte) int // 读取最大out长度的数据,返回读出数据长度 CopyOutLen(out []byte, outLen int) error // 读取outLen长度的数据,如果数据不足 outLen 返回 error }
type RingBuffer ¶ added in v1.5.6
func NewRingBuffer ¶ added in v1.5.6
func NewRingBuffer(cap uint32, autoGrow bool) RingBuffer
type Writer ¶ added in v1.1.5
type Writer interface { io.Writer Clean() Reserve(cap int) error ResetLen(len int) AssignString(s string) error AssignBytes(p []byte) error AppendString(s string) error AppendBytes(p []byte) error // 将p写入 ringBuffer,如果 ringBuffer 不足,返回错误 GetTailEmptyBytes() []byte //与AddLen配合使用,用于需要转写数据的场景但又只有[]byte接口的地方,但需要注意,有可能尾部空间都有数据时,可能需要自行调用MoveHeadZeroRIndex释放空间 AddLen(len int) //与GetEmptyBytes配合使用 MoveHeadZeroRIndex() }
Click to show internal directories.
Click to hide internal directories.