diff --git a/bytebuffer.go b/bytebuffer.go index aed9fb1..0e83cfe 100644 --- a/bytebuffer.go +++ b/bytebuffer.go @@ -14,8 +14,12 @@ type ByteBuffer struct { B []byte } -// Bytes returns all bytes contained in buffer -func (b *ByteBuffer) Bytes() []byte { return b.B } +// Bytes returns b.B, i.e. all the bytes accumulated in the buffer. +// +// The purpose of this function is bytes.Buffer compatibility. +func (b *ByteBuffer) Bytes() []byte { + return b.B +} // Write implements io.Writer - it appends p to ByteBuffer.B func (b *ByteBuffer) Write(p []byte) (int, error) { @@ -24,7 +28,10 @@ func (b *ByteBuffer) Write(p []byte) (int, error) { } // WriteByte appends the byte c to the buffer. -// The returned error is always nil. +// +// The purpose of this function is bytes.Buffer compatibility. +// +// The function always returns nil. func (b *ByteBuffer) WriteByte(c byte) error { b.B = append(b.B, c) return nil