Documentation
¶
Index ¶
- Constants
- Variables
- type Type
- func (b *Type) Close() error
- func (b *Type) ID() int64
- func (b *Type) Len() int
- func (b *Type) Read(p []byte) (int, error)
- func (b *Type) ReadCommit(n int) (int, error)
- func (b *Type) ReadFrom(r io.Reader) (int64, error)
- func (b *Type) ReadPeek(n int) ([]byte, error)
- func (b *Type) ReadWait(n int) ([]byte, error)
- func (b *Type) Send(from [][]byte) (int, error)
- func (b *Type) Size() int64
- func (b *Type) Write(p []byte) (int, error)
- func (b *Type) WriteCommit(n int) (int, error)
- func (b *Type) WriteTo(w io.Writer) (int64, error)
- func (b *Type) WriteWait(n int) ([]byte, bool, error)
Constants ¶
const ( // DefaultBufferSize buffer size created by default DefaultBufferSize = 1024 * 256 // DefaultReadBlockSize default read block size DefaultReadBlockSize = 8192 // DefaultWriteBlockSize default write block size DefaultWriteBlockSize = 8192 )
Variables ¶
var ( // ErrInsufficientData buffer has insufficient data ErrInsufficientData = errors.New("buffer has insufficient data") // ErrInsufficientSpace buffer has insufficient space ErrInsufficientSpace = errors.New("buffer has insufficient space") // ErrNotReady buffer is not ready yet ErrNotReady = errors.New("buffer is not ready") )
Functions ¶
This section is empty.
Types ¶
type Type ¶
type Type struct { ExternalBuf []byte // contains filtered or unexported fields }
Type of buffer align atomic values to prevent panics on 32 bits macnines see https://github.com/golang/go/issues/5278
func (*Type) ReadCommit ¶
ReadCommit Commit moves the cursor forward by n bytes. It behaves like Read() except it doesn't return any data. If there's enough data, then the cursor will be moved forward and n will be returned. If there's not enough data, then the cursor will move forward as much as possible, then return the number of positions (bytes) moved.
func (*Type) ReadPeek ¶
ReadPeek Description below is copied completely from bufio.Peek()
http://golang.org/pkg/bufio/#Reader.Peek
Peek returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call. If Peek returns fewer than n bytes, it also returns an error explaining why the read is short. The error is bufio.ErrBufferFull if n is larger than b's buffer size. If there's not enough data to peek, error is ErrBufferInsufficientData. If n < 0, error is bufio.ErrNegativeCount
func (*Type) ReadWait ¶
ReadWait waits for for n bytes to be ready. If there's not enough data, then it will wait until there's enough. This differs from ReadPeek or Readin that Peek will return whatever is available and won't wait for full count.
func (*Type) WriteCommit ¶
WriteCommit write with commit
func (*Type) WriteWait ¶
WriteWait waits for n bytes to be available in the buffer and then returns 1. the slice pointing to the location in the buffer to be filled 2. a boolean indicating whether the bytes available wraps around the ring 3. any errors encountered. If there's error then other return values are invalid