Documentation
¶
Index ¶
- Variables
- func B2S(b []byte) string
- func Copy(b []byte) []byte
- func S2B(s string) []byte
- type Buffer
- func (buf *Buffer) Cap() int
- func (buf *Buffer) Full() []byte
- func (buf *Buffer) Grow(sz int)
- func (buf *Buffer) Guarantee(sz int)
- func (buf *Buffer) Len() int
- func (buf *Buffer) ReadFrom(r io.Reader) (int64, error)
- func (buf *Buffer) Reset()
- func (buf *Buffer) String() string
- func (buf *Buffer) Truncate(n int)
- func (buf *Buffer) Write(b []byte) (int, error)
- func (buf *Buffer) WriteAt(b []byte, start int64) (int, error)
- func (buf *Buffer) WriteByte(c byte) error
- func (buf *Buffer) WriteRune(r rune) (int, error)
- func (buf *Buffer) WriteString(s string) (int, error)
- func (buf *Buffer) WriteStringAt(s string, start int64) (int, error)
- func (buf *Buffer) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBeyondBufferLen is returned if .WriteAt() is attempted beyond buffer length. ErrBeyondBufferLen = errors.New("start beyond buffer length") )
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct{ B []byte }
Buffer is a simple wrapper around a byte slice.
func (*Buffer) Full ¶ added in v1.0.2
Full returns the full capacity byteslice allocated for this buffer.
func (*Buffer) Grow ¶
Grow will increase the buffers length by 'sz', and the capacity by at least this.
func (*Buffer) Guarantee ¶
Guarantee will guarantee buffer containers at least 'sz' remaining capacity.
func (*Buffer) ReadFrom ¶ added in v1.2.0
ReadFrom will read bytes from reader into buffer, fulfilling io.ReaderFrom.
func (*Buffer) Reset ¶
func (buf *Buffer) Reset()
Reset will reset the buffer length to 0 (retains capacity).
func (*Buffer) String ¶
String returns the underlying byte slice as a string. Please note this value is tied directly to the underlying byte slice, if you write to the buffer then returned string values will also change.
To get an immutable string from buffered data, use string(buf.B).
func (*Buffer) WriteAt ¶
WriteAt will append given byte slice to buffer at index 'start', fulfilling io.WriterAt.
func (*Buffer) WriteString ¶
WriteString will append given string to buffer, fulfilling io.StringWriter.
func (*Buffer) WriteStringAt ¶
WriteStringAt will append given string to buffer at index 'start'.