Documentation ¶
Index ¶
- type Buffer
- func (llb *Buffer) AllocNode(n int) []byte
- func (llb *Buffer) Append(p []byte)
- func (llb *Buffer) Buffered() int
- func (llb *Buffer) Discard(n int) (discarded int, err error)
- func (llb *Buffer) FreeNode(p []byte)
- func (llb *Buffer) IsEmpty() bool
- func (llb *Buffer) Len() int
- func (llb *Buffer) Peek(maxBytes int) ([][]byte, error)
- func (llb *Buffer) PeekWithBytes(maxBytes int, bs ...[]byte) ([][]byte, error)
- func (llb *Buffer) Pop() []byte
- func (llb *Buffer) PushBack(p []byte)
- func (llb *Buffer) PushFront(p []byte)
- func (llb *Buffer) Read(p []byte) (n int, err error)
- func (llb *Buffer) ReadFrom(r io.Reader) (n int64, err error)
- func (llb *Buffer) Reset()
- func (llb *Buffer) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a linked list of node.
func (*Buffer) AllocNode ¶ added in v2.5.0
AllocNode allocates a []byte with the given length that is expected to be pushed into the Buffer.
func (*Buffer) Buffered ¶
Buffered returns the number of bytes that can be read from the current buffer.
func (*Buffer) FreeNode ¶ added in v2.5.0
FreeNode puts the given []byte back to the pool to free the memory.
func (*Buffer) Peek ¶
Peek assembles the up to maxBytes of [][]byte based on the list of node, it won't remove these nodes from l until Discard() is called.
func (*Buffer) PeekWithBytes ¶
PeekWithBytes is like Peek but accepts [][]byte and puts them onto head.
func (*Buffer) Pop ¶ added in v2.5.0
Pop removes and returns the buffer of the head or nil if the list is empty.
func (*Buffer) PushFront ¶
PushFront is a wrapper of pushFront, which accepts []byte as its argument.