Documentation ¶
Overview ¶
Package circle 环形缓冲区 实现了 io.Reader, io.Writer, io.ReadWriter 接口 非线程安全
Index ¶
- Variables
- type Circle
- func (c *Circle) Cap() int
- func (c *Circle) Free() int
- func (c *Circle) Get(n int) ([]byte, error)
- func (c *Circle) IsEmpty() bool
- func (c *Circle) IsFull() bool
- func (c *Circle) Len() int
- func (c *Circle) Peek(n int) ([]byte, error)
- func (c *Circle) Read(p []byte) (int, error)
- func (c *Circle) ReadN(n int, p []byte) error
- func (c *Circle) Reset()
- func (c *Circle) Skip(n int) error
- func (c *Circle) String() string
- func (c *Circle) Write(p []byte) (int, error)
- func (c *Circle) WriteN(p []byte, n int) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTooManyToWrite 内容太长,无法写入 ErrTooManyToWrite = errors.New("too many data to write") // ErrInvalidBuffer 用于读取的 buffer 无效 ErrInvalidBuffer = errors.New("invalid buffer") // ErrNotEnough 数据不足以读取长度 n 的内容 ErrNotEnough = errors.New("not enough data") // ErrInvalidSkipSize 无效的长度 ErrInvalidSkipSize = errors.New("invalid skip size") // ErrIsFull 缓冲区已满 ErrIsFull = errors.New("buffer is full") // ErrIsEmpty 缓冲区已满 ErrIsEmpty = errors.New("buffer is empty") // ErrInvalidLength 无效长度 ErrInvalidLength = errors.New("invalid length") )
Functions ¶
This section is empty.
Types ¶
type Circle ¶
type Circle struct {
// contains filtered or unexported fields
}
Circle 环形结构
func (*Circle) ReadN ¶
ReadN 读取长度 n 的内容到 p 中 只存在读取了长度 n 的内容到 p 中,和 一点都不读取两种情况 不存在只读了部分(< n) 的内容到 p 中的情况
Click to show internal directories.
Click to hide internal directories.