Documentation ¶
Index ¶
- Constants
- Variables
- func Read(reader io.Reader, order Order, data interface{}) error
- func ReadByte(v []byte) byte
- func ReadDouble(v []byte) float64
- func ReadEByte(v []byte) (byte, error)
- func ReadEDouble(v []byte) (float64, error)
- func ReadEFloat(v []byte) (float32, error)
- func ReadEInt(v []byte) (int32, error)
- func ReadELDouble(v []byte) (float64, error)
- func ReadELFloat(v []byte) (float32, error)
- func ReadELInt(v []byte) (int32, error)
- func ReadELLong(v []byte) (int64, error)
- func ReadELShort(v []byte) (int16, error)
- func ReadELUInt(v []byte) (uint32, error)
- func ReadELULong(v []byte) (uint64, error)
- func ReadELUShort(v []byte) (uint16, error)
- func ReadELong(v []byte) (int64, error)
- func ReadESByte(v []byte) (int8, error)
- func ReadEShort(v []byte) (int16, error)
- func ReadEUInt(v []byte) (uint32, error)
- func ReadEULong(v []byte) (uint64, error)
- func ReadEUShort(v []byte) (uint16, error)
- func ReadFloat(v []byte) float32
- func ReadInt(v []byte) int32
- func ReadLDouble(v []byte) float64
- func ReadLFloat(v []byte) float32
- func ReadLInt(v []byte) int32
- func ReadLLong(v []byte) int64
- func ReadLShort(v []byte) int16
- func ReadLUInt(v []byte) uint32
- func ReadLULong(v []byte) uint64
- func ReadLUShort(v []byte) uint16
- func ReadLong(v []byte) int64
- func ReadSByte(v []byte) int8
- func ReadShort(v []byte) int16
- func ReadUInt(v []byte) uint32
- func ReadULong(v []byte) uint64
- func ReadUShort(v []byte) uint16
- func Write(writer io.Writer, order Order, data interface{}) error
- func WriteByte(v byte) []byte
- func WriteDouble(v float64) []byte
- func WriteFloat(v float32) []byte
- func WriteInt(v int32) []byte
- func WriteLDouble(v float64) []byte
- func WriteLFloat(v float32) []byte
- func WriteLInt(v int32) []byte
- func WriteLLong(v int64) []byte
- func WriteLShort(v int16) []byte
- func WriteLUInt(v uint32) []byte
- func WriteLULong(v uint64) []byte
- func WriteLUShort(v uint16) []byte
- func WriteLong(v int64) []byte
- func WriteSByte(v int8) []byte
- func WriteShort(v int16) []byte
- func WriteUInt(v uint32) []byte
- func WriteULong(v uint64) []byte
- func WriteUShort(v uint16) []byte
- type Order
- type OrderStream
- func (bs *OrderStream) Double() (value float64, err error)
- func (bs *OrderStream) Float() (value float32, err error)
- func (bs *OrderStream) Int() (value int32, err error)
- func (bs *OrderStream) Long() (value int64, err error)
- func (bs *OrderStream) PutDouble(value float64) error
- func (bs *OrderStream) PutFloat(value float32) error
- func (bs *OrderStream) PutInt(value int32) error
- func (bs *OrderStream) PutLong(value int64) error
- func (bs *OrderStream) PutSShort(value int16) error
- func (bs *OrderStream) PutShort(value uint16) error
- func (bs *OrderStream) SShort() (value int16, err error)
- func (bs *OrderStream) Short() (value uint16, err error)
- type Stream
- func (bs *Stream) AllBytes() []byte
- func (bs *Stream) Bool() (bool, error)
- func (bs *Stream) Byte() (byte, error)
- func (bs *Stream) Bytes() []byte
- func (bs *Stream) Double() (float64, error)
- func (bs *Stream) Float() (float32, error)
- func (bs *Stream) Get(n int) []byte
- func (bs *Stream) Int() (int32, error)
- func (bs *Stream) LDouble() (float64, error)
- func (bs *Stream) LFloat() (float32, error)
- func (bs *Stream) LInt() (int32, error)
- func (bs *Stream) LLong() (int64, error)
- func (bs *Stream) LSShort() (int16, error)
- func (bs *Stream) LShort() (uint16, error)
- func (bs *Stream) Len() int
- func (bs *Stream) Long() (int64, error)
- func (bs *Stream) Off() int
- func (bs *Stream) Pad(le int) error
- func (bs *Stream) Put(value []byte) error
- func (bs *Stream) PutBool(value bool) error
- func (bs *Stream) PutByte(value byte) error
- func (bs *Stream) PutDouble(value float64) error
- func (bs *Stream) PutFloat(value float32) error
- func (bs *Stream) PutInt(value int32) error
- func (bs *Stream) PutLDouble(value float64) error
- func (bs *Stream) PutLFloat(value float32) error
- func (bs *Stream) PutLInt(value int32) error
- func (bs *Stream) PutLLong(value int64) error
- func (bs *Stream) PutLSShort(value int16) error
- func (bs *Stream) PutLShort(value uint16) error
- func (bs *Stream) PutLong(value int64) error
- func (bs *Stream) PutSByte(value int8) error
- func (bs *Stream) PutSShort(value int16) error
- func (bs *Stream) PutShort(value uint16) error
- func (bs *Stream) Read(p []byte) (n int, err error)
- func (bs *Stream) Reset()
- func (bs *Stream) SByte() (int8, error)
- func (bs *Stream) SShort() (int16, error)
- func (bs *Stream) SetBytes(b []byte)
- func (bs *Stream) Short() (uint16, error)
- func (bs *Stream) Skip(n int)
- func (bs *Stream) Write(p []byte) (n int, err error)
Constants ¶
const ( // ByteSize is byte size of Byte ByteSize = 1 // ShortSize is byte size of Short ShortSize = 2 // IntSize is byte size of Int IntSize = 4 // LongSize is byte size of Long LongSize = 8 // FloatSize is byte size of Float FloatSize = 4 // DoubleSize is byte size of Double DoubleSize = 8 )
Variables ¶
var BigEndian bigEndian
BigEndian .
var ErrNotEnought = errors.New("binary: not enough bytes")
var LittleEndian littleEndian
LittleEndian .
Functions ¶
func ReadDouble ¶
func ReadEDouble ¶
func ReadEFloat ¶
func ReadELDouble ¶
func ReadELFloat ¶
func ReadELLong ¶
func ReadELShort ¶
func ReadELUInt ¶
func ReadELULong ¶
func ReadELUShort ¶
func ReadESByte ¶
func ReadEShort ¶
func ReadEULong ¶
func ReadEUShort ¶
func ReadLDouble ¶
func ReadLFloat ¶
func ReadLShort ¶
func ReadLULong ¶
func ReadLUShort ¶
func ReadUShort ¶
func WriteDouble ¶
func WriteFloat ¶
func WriteLDouble ¶
func WriteLFloat ¶
func WriteLLong ¶
func WriteLShort ¶
func WriteLUInt ¶
func WriteLULong ¶
func WriteLUShort ¶
func WriteSByte ¶
func WriteShort ¶
func WriteULong ¶
func WriteUShort ¶
Types ¶
type Order ¶
type Order interface { Byte(v []byte) byte SByte(v []byte) int8 Short(v []byte) int16 UShort(v []byte) uint16 Int(v []byte) int32 UInt(v []byte) uint32 Long(v []byte) int64 ULong(v []byte) uint64 Float(v []byte) float32 Double(v []byte) float64 PutByte(v byte) []byte PutSByte(v int8) []byte PutShort(v int16) []byte PutUShort(v uint16) []byte PutInt(v int32) []byte PutUInt(v uint32) []byte PutLong(v int64) []byte PutULong(v uint64) []byte PutFloat(v float32) []byte PutDouble(v float64) []byte }
Order is a byte order interface
type OrderStream ¶
OrderStream is a binary stream with order
func NewOrderStream ¶
func NewOrderStream(order Order) *OrderStream
NewOrderStream returns new Stream
func NewOrderStreamBytes ¶
func NewOrderStreamBytes(order Order, b []byte) *OrderStream
NewOrderStreamBytes returns new Stream from bytes
func (*OrderStream) Double ¶
func (bs *OrderStream) Double() (value float64, err error)
Double sets double got from buffer to value
func (*OrderStream) Float ¶
func (bs *OrderStream) Float() (value float32, err error)
Float sets float got from buffer to value
func (*OrderStream) Int ¶
func (bs *OrderStream) Int() (value int32, err error)
Int sets int got from buffer to value
func (*OrderStream) Long ¶
func (bs *OrderStream) Long() (value int64, err error)
Long sets long got from buffer to value
func (*OrderStream) PutDouble ¶
func (bs *OrderStream) PutDouble(value float64) error
PutFloat puts double from value to buffer
func (*OrderStream) PutFloat ¶
func (bs *OrderStream) PutFloat(value float32) error
PutFloat puts float from value to buffer
func (*OrderStream) PutInt ¶
func (bs *OrderStream) PutInt(value int32) error
PutInt puts int from value to buffer
func (*OrderStream) PutLong ¶
func (bs *OrderStream) PutLong(value int64) error
PutLong puts long from value to buffer
func (*OrderStream) PutSShort ¶
func (bs *OrderStream) PutSShort(value int16) error
PutSShort puts short(sign) from value to buffer
func (*OrderStream) PutShort ¶
func (bs *OrderStream) PutShort(value uint16) error
PutShort puts short(unsign) from value to buffer
func (*OrderStream) SShort ¶
func (bs *OrderStream) SShort() (value int16, err error)
SShort sets short(sign) got from buffer to value
func (*OrderStream) Short ¶
func (bs *OrderStream) Short() (value uint16, err error)
Short sets short(unsign) got from buffer to value
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is basic binary stream.
func NewStreamBytes ¶
NewStreamBytes returns new Stream from bytes
func (*Stream) PutLDouble ¶
PutFloat puts double from value to buffer as LittleEndian
func (*Stream) PutLSShort ¶
PutLSShort puts short(sign) from value to buffer as LittleEndian