Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Reader ¶ added in v1.1.5
type Reader interface { IsCanGrow() bool GetCapacity() int // 获取总空间大小 GetDataSize() int // 获取占用的数据空间大小 GetTailSize() int // 获取尾部空间大小 GetEmptySize() int // 获取空余总空间大小 io.Reader Peek() []byte PeekLen(outLen int) []byte TakeOut() (out []byte) TakeOutLen(outLen int) (out []byte, err error) CopyOut(out []byte) int // 读取最大out长度的数据,返回读出数据长度 CopyOutLen(out []byte, outLen int) error // 读取outLen长度的数据,如果数据不足 outLen 返回 error }
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写入 buffer,如果 buffer 不足,返回错误 GetTailEmptyBytes() []byte //与AddLen配合使用,用于需要转写数据的场景但又只有[]byte接口的地方,但需要注意,有可能尾部空间都有数据时,可能需要自行调用MoveHeadZeroRIndex释放空间 AddLen(len int) //与GetEmptyBytes配合使用 MoveHeadZeroRIndex() }
Click to show internal directories.
Click to hide internal directories.