Documentation ¶
Index ¶
- Constants
- Variables
- func Swap(a *Buffer, b *Buffer)
- type Buffer
- func (b *Buffer) Append(data []byte)
- func (b *Buffer) AppendBuffer(o *Buffer)
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Clear()
- func (b *Buffer) Concat()
- func (b *Buffer) Discard()
- func (b *Buffer) Empty() bool
- func (b *Buffer) Eof() bool
- func (b *Buffer) Iter() Iterator
- func (b *Buffer) Len() int
- func (b *Buffer) Mark() int
- func (b *Buffer) Peek(data []byte) (int, error)
- func (b *Buffer) Pos() int
- func (b *Buffer) Prepend(data []byte)
- func (b *Buffer) Read(data []byte) (int, error)
- func (b *Buffer) ReadByte() (byte, error)
- func (b *Buffer) Seek(offset int64, whence int) (int64, error)
- func (b *Buffer) SetMark(v int)
- func (b *Buffer) Split() *Buffer
- func (b *Buffer) String() string
- func (b *Buffer) Visit(cb func([]byte) bool)
- func (b *Buffer) Write(data []byte) (int, error)
- func (b *Buffer) WriteAll(w io.Writer) (int, error)
- func (b *Buffer) WriteByte(data byte) error
- type Iterator
- type LockedBuffer
- type Pool
- type Reader
- type Writer
- func (w *Writer) Flush()
- func (w *Writer) Init(b *Buffer, chunk int)
- func (w *Writer) PutByte(b byte)
- func (w *Writer) PutBytes(d []byte)
- func (w *Writer) PutInt16BE(i int16)
- func (w *Writer) PutInt16LE(i int16)
- func (w *Writer) PutInt32BE(i int32)
- func (w *Writer) PutInt32LE(i int32)
- func (w *Writer) PutInt64BE(i int64)
- func (w *Writer) PutInt64LE(i int64)
- func (w *Writer) PutLen(i int)
- func (w *Writer) PutString(s string) bool
- func (w *Writer) PutUInt16BE(i uint16)
- func (w *Writer) PutUInt16LE(i uint16)
- func (w *Writer) PutUInt32BE(i uint32)
- func (w *Writer) PutUInt32LE(i uint32)
- func (w *Writer) PutUInt64BE(i uint64)
- func (w *Writer) PutUInt64LE(i uint64)
- func (w *Writer) PutUVarint(u uint)
- func (w *Writer) PutUVarint32(u uint32)
- func (w *Writer) PutUVarint64(u uint64)
- func (w *Writer) PutVarint(i int)
- func (w *Writer) PutVarint32(i int32)
- func (w *Writer) PutVarint64(i int64)
Constants ¶
View Source
const ( SeekStart = io.SeekStart SeekCurrent = io.SeekCurrent SeekEnd = io.SeekEnd )
Variables ¶
View Source
var ( ErrOverflow = errors.New("buffer overflow") ErrNoEnoughData = errors.New("no enough data") )
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer 使用链表的方式管理数据
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator 迭代器,只能向前或者向后,不能随意来回迭代
type LockedBuffer ¶
LockedBuffer,增加Mutex,但需要外部手动加锁和释放锁
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) ReadLenString ¶
func (*Reader) ReadUVarint ¶
func (*Reader) ReadVarintLen ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer 带有缓存的写Buffer
func (*Writer) PutInt32BE ¶
func (*Writer) PutInt32LE ¶
func (*Writer) PutInt64BE ¶
func (*Writer) PutInt64LE ¶
func (*Writer) PutUInt16BE ¶
func (*Writer) PutUInt16LE ¶
func (*Writer) PutUInt32BE ¶
func (*Writer) PutUInt32LE ¶
func (*Writer) PutUInt64BE ¶
func (*Writer) PutUInt64LE ¶
func (*Writer) PutUVarint ¶
func (*Writer) PutUVarint32 ¶
func (*Writer) PutUVarint64 ¶
func (*Writer) PutVarint32 ¶
func (*Writer) PutVarint64 ¶
Click to show internal directories.
Click to hide internal directories.