mirror of
https://github.com/valyala/bytebufferpool.git
synced 2026-06-14 13:26:35 +03:00
+10
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user