1
0
mirror of https://github.com/golang/go synced 2024-11-13 17:30:24 -07:00

add a couple of helper methods to io.ByteBuffer

R=rsc
DELTA=456  (9 added, 2 deleted, 445 changed)
OCL=23107
CL=23107
This commit is contained in:
Rob Pike 2009-01-20 12:57:25 -08:00
parent f48cbfdf56
commit b74e3b95cf

View File

@ -75,10 +75,18 @@ func (b *ByteBuffer) Len() int {
return b.len
}
func (b *ByteBuffer) Off() int {
return b.off
}
func (b *ByteBuffer) Data() []byte {
return b.buf[b.off:b.len]
}
func (b *ByteBuffer) AllData() []byte {
return b.buf[0:b.len]
}
export func NewByteBufferFromArray(buf []byte) *ByteBuffer {
b := new(ByteBuffer);