From: Rob Pike Date: Tue, 20 Jan 2009 20:57:25 +0000 (-0800) Subject: add a couple of helper methods to io.ByteBuffer X-Git-Tag: weekly.2009-11-06~2329 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b74e3b95cffe71cb6fd3c9f4209860f559af9d3c;p=gostls13.git add a couple of helper methods to io.ByteBuffer R=rsc DELTA=456 (9 added, 2 deleted, 445 changed) OCL=23107 CL=23107 --- diff --git a/src/lib/io/bytebuffer.go b/src/lib/io/bytebuffer.go index 59547afb4a..5faeff9eb7 100644 --- a/src/lib/io/bytebuffer.go +++ b/src/lib/io/bytebuffer.go @@ -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);