func (this *BufferStream) Len() int {
	return len(this.buf)
}
Len returns the size of the stream
package util
import (
	"errors"
)
type BufferStream struct {
	buf    []byte
	off    int
	closed bool
}
func NewBufferStream(buf []byte) *BufferStream {
	this := &BufferStream{}
	this.buf = buf
	return this
}
func (this *BufferStream) Write(b []byte) (int, error) {
	if this.closed == true {
		return 0, errors.New("Stream closed")
	}
	this.buf = append(this.buf, b...)
	return len(b), nil
}
func (this *BufferStream) Read(b []byte) (int, error) {
	if this.closed == true {
		return 0, errors.New("Stream closed")
	}
	if len(b) < len(this.buf[this.off:]) {
		copy(b, this.buf[this.off:this.off+len(b)])
		this.off += len(b)
		return len(b), nil
	}
	copy(b, this.buf[this.off:])
	old := this.off
	this.off = len(this.buf)
	return len(this.buf) - old, nil
}
func (this *BufferStream) Close() error {
	this.closed = true
	return nil
}