Documentation ¶
Index ¶
- func ReadAll(b ByteBuf) ([]byte, error)
- type ByteBuf
- func Append(one, two ByteBuf) ByteBuf
- func Empty() ByteBuf
- func NewFromBytesReader(r *bytes.Reader) ByteBuf
- func NewFromFile(f *os.File) (ByteBuf, error)
- func NewFromReader(r io.Reader, dir string) (ByteBuf, error)
- func NewFromSlice(b []byte) ByteBuf
- func NewFromSlices(bs ...[]byte) ByteBuf
- func NewFromString(s string) ByteBuf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ByteBuf ¶
type ByteBuf interface { io.ReaderAt io.Closer // The io.WriterTo implementation for all ByteBufs is guaranteed to be // concurrency-safe - i.e. it does not modify an internal offset and // can be used multiple times without changing the written data. io.WriterTo // Length returns the length of this ByteBuf. Length() int64 // AsReader returns an io.Reader that reads the contents of this // ByteBuf. The returned Reader will only be valid so long as this // ByteBuf has not been closed. AsReader() io.Reader }
ByteBuf is an interface for a concurrency-safe read-only buffer of bytes that can be read in a variety of ways.
func NewFromBytesReader ¶
NewFromBytesReader creates a ByteBuf from an underlying file.
func NewFromFile ¶
NewFromFile creates a ByteBuf from an underlying file.
func NewFromReader ¶
NewFromReader creates a ByteBuf from an io.Reader. It will buffer data to disk in the provided directory.
func NewFromSlice ¶
NewFromSlice creates a ByteBuf from an underlying slice. This avoids an extra allocation for the single-slice case compared to NewFromSlices.
func NewFromSlices ¶
NewFromSlices creates a ByteBuf from multiple slices.
func NewFromString ¶ added in v0.0.2
NewFromString creates a ByteBuf from an underlying string. This is a convenience method around NewFromSlice.
Click to show internal directories.
Click to hide internal directories.