Documentation
¶
Index ¶
- func Copy(b []byte) []byte
- func Equal(a, b []byte) bool
- func Extend(b []byte, needLen int) []byte
- func Prepend(dst []byte, src ...byte) []byte
- func PrependString(dst []byte, src string) []byte
- func Rand(dst []byte) []byte
- type ByteBuffer
- func (b *ByteBuffer) Bytes() []byte
- func (b *ByteBuffer) Len() int
- func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)
- func (b *ByteBuffer) Reset()
- func (b *ByteBuffer) Set(p []byte)
- func (b *ByteBuffer) SetString(s string)
- func (b *ByteBuffer) String() string
- func (b *ByteBuffer) Write(p []byte) (int, error)
- func (b *ByteBuffer) WriteByte(c byte) error
- func (b *ByteBuffer) WriteString(s string) (int, error)
- func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrependString ¶
PrependString добавляет строку в переданный байтовый срез dst.
Types ¶
type ByteBuffer ¶
type ByteBuffer struct {
B []byte
}
ByteBuffer provides byte buffer, which can be used for minimizing memory allocations. ByteBuffer may be used with functions appending data to the given []byte slice.
func (*ByteBuffer) Bytes ¶
func (b *ByteBuffer) Bytes() []byte
Bytes returns b.B, i.e. all the bytes accumulated in the buffer. The purpose of this function is bytes.Buffer compatibility.
func (*ByteBuffer) ReadFrom ¶
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)
ReadFrom implements io.ReaderFrom. The function appends all the data read from r to b.
func (*ByteBuffer) SetString ¶
func (b *ByteBuffer) SetString(s string)
SetString sets ByteBuffer.B to s.
func (*ByteBuffer) String ¶
func (b *ByteBuffer) String() string
String returns string representation of ByteBuffer.
func (*ByteBuffer) Write ¶
func (b *ByteBuffer) Write(p []byte) (int, error)
Write implements io.Writer - it appends p to ByteBuffer.B
func (*ByteBuffer) WriteByte ¶
func (b *ByteBuffer) WriteByte(c byte) error
WriteByte appends the byte c to the buffer. The purpose of this function is bytes.Buffer compatibility. The function always returns nil.
func (*ByteBuffer) WriteString ¶
func (b *ByteBuffer) WriteString(s string) (int, error)
WriteString appends s to ByteBuffer.B.