func NewByteStream(b []byte) (*ByteStream, error) {
	binary := make([]byte, len(b))
	n := copy(binary, b)
	if len(b) != n {
		return nil, errors.New("failed to copy input buffers")
	}
	return &ByteStream{
		pos:    0,
		sType:  MEMORY,
		binary: binary,
		cache:  make([]byte, CacheSize),
		r:      bytes.NewReader(binary),
	}, nil
}
// NewByteStream creates a new binary stream from a byte slice (can be memory mapped file).
NewByteStream creates a new binary stream from a byte slice (can be memory mapped file).
// NewByteStream creates a new binary stream from a byte slice ( can be memory mapped file ) .
func NewByteStream(b []byte) (*ByteStream, error) {
	binary := make([]byte, len(b))
	n := copy(binary, b)
	if len(b) != n {
		return nil, errors.New("failed to copy input buffers")
	}
	return &ByteStream{
		pos:    0,
		sType:  MEMORY,
		binary: binary,
		cache:  make([]byte, CacheSize),
		r:      bytes.NewReader(binary),
	}, nil
}
func NewByteStream ( b [ ] byte ) ( * ByteStream , error ) { binary := make ( [ ] byte , len ( b ) ) n := copy ( binary , b ) if len ( b ) != n { return nil , errors . New ( " " ) } return & ByteStream { pos : 0 , sType : MEMORY , binary : binary , cache : make ( [ ] byte , CacheSize ) , r : bytes . NewReader ( binary ) , } , nil }
NewByteStream creates a new binary stream from a byte slice (can be memory mapped file).
NewByteStream creates a new binary stream from a byte slice ( can be memory mapped file ) .