Documentation
¶
Index ¶
- Variables
- type Buffer
- func (buf *Buffer) Cap() int
- func (buf *Buffer) Grow(sz int)
- func (buf *Buffer) Guarantee(sz int)
- func (buf *Buffer) Len() int
- 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)
Constants ¶
This section is empty.
Variables ¶
var ErrBeyondBufferLen = errors.New("start beyond buffer length")
ErrBeyondBufferLen is returned if .WriteAt() is attempted beyond buffer length.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct{ B []byte }
Buffer is a simple wrapper around a byte slice.
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) 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.