func NewFixed(data []byte) *Buffer {
	return &Buffer{
		data:      data,
		fixed:     true,
		available: len(data),
	}
}
NewFixed create new fixed buffer from data slice being retained by the buffer.
package streambuf
import (
	"github.com/elastic/beats/libbeat/logp"
	"bytes"
	"errors"
)
var ErrOperationNotAllowed = errors.New("Operation not allowed")
var ErrOutOfRange = errors.New("Data access out of range")
var ErrNoMoreBytes = errors.New("No more bytes")
var ErrUnexpectedEOB = errors.New("unexpected end of buffer")
var ErrExpectedByteSequenceMismatch = errors.New("expected byte sequence did not match")
type Buffer struct {
	data  []byte
	err   error
	fixed bool
	mark, offset, available int
}
func (b *Buffer) Init(d []byte, fixed bool) {
	b.data = d
	b.err = nil
	b.fixed = fixed
	b.mark = 0
	b.offset = 0
	b.available = len(d)
}
func New(data []byte) *Buffer {
	return &Buffer{
		data:      data,
		fixed:     false,
		available: len(data),
	}
}