A Buffer is a variable-sized buffer of bytes with read() and write() methods. Based on https://golang.org/pkg/bytes/#Buffer
Returns the capacity of the buffer's underlying byte slice, that is, the total space allocated for the buffer's data.
length is a getter that returns the number of bytes of the unread portion of the buffer
bytes() returns a slice holding the unread portion of the buffer. The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like read(), write(), reset(), or truncate()). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads.
empty() returns whether the unread portion of the buffer is empty.
grow() grows the buffer's capacity, if necessary, to guarantee space for another n bytes. After grow(n), at least n bytes can be written to the buffer without another allocation. If n is negative, grow() will panic. If the buffer can't grow it will throw ErrTooLarge. Based on https://golang.org/pkg/bytes/#Buffer.Grow
readFrom() reads data from r until EOF and appends it to the buffer, growing the buffer as needed. It returns the number of bytes read. If the buffer becomes too large, readFrom will panic with ErrTooLarge. Based on https://golang.org/pkg/bytes/#Buffer.ReadFrom
Sync version of
readSync() reads the next len(p) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, eof in the response will be true.
reset() resets the buffer to be empty, but it retains the underlying storage for use by future writes. reset() is the same as truncate(0)
toString() returns the contents of the unread portion of the buffer as a string. Warning - if multibyte characters are present when data is flowing through the buffer, this method may result in incorrect strings due to a character being split.
truncate() discards all but the first n unread bytes from the buffer but continues to use the same allocated storage. It throws if n is negative or greater than the length of the buffer.
Generated using TypeDoc