Documentation ¶
Overview ¶
Package binary translates between select fixed-sized types and a binary representation.
Index ¶
- Variables
- func AppendUint16(buf []byte, order binary.ByteOrder, num uint16) []byte
- func AppendUint32(buf []byte, order binary.ByteOrder, num uint32) []byte
- func AppendUint64(buf []byte, order binary.ByteOrder, num uint64) []byte
- func Marshal(buf []byte, order binary.ByteOrder, data interface{}) []byte
- func ReadUint16(r io.Reader, order binary.ByteOrder) (uint16, error)
- func ReadUint32(r io.Reader, order binary.ByteOrder) (uint32, error)
- func ReadUint64(r io.Reader, order binary.ByteOrder) (uint64, error)
- func Size(v interface{}) uintptr
- func Unmarshal(buf []byte, order binary.ByteOrder, data interface{})
- func WriteUint16(w io.Writer, order binary.ByteOrder, num uint16) error
- func WriteUint32(w io.Writer, order binary.ByteOrder, num uint32) error
- func WriteUint64(w io.Writer, order binary.ByteOrder, num uint64) error
Constants ¶
This section is empty.
Variables ¶
var BigEndian = binary.BigEndian
BigEndian is the same as encoding/binary.BigEndian.
It is included here as a convenience.
var LittleEndian = binary.LittleEndian
LittleEndian is the same as encoding/binary.LittleEndian.
It is included here as a convenience.
Functions ¶
func AppendUint16 ¶
AppendUint16 appends the binary representation of a uint16 to buf.
func AppendUint32 ¶
AppendUint32 appends the binary representation of a uint32 to buf.
func AppendUint64 ¶
AppendUint64 appends the binary representation of a uint64 to buf.
func Marshal ¶
Marshal appends a binary representation of data to buf.
data must only contain fixed-length signed and unsigned ints, arrays, slices, structs and compositions of said types. data may be a pointer, but cannot contain pointers.
func ReadUint16 ¶
ReadUint16 reads a uint16 from r.
func ReadUint32 ¶
ReadUint32 reads a uint32 from r.
func ReadUint64 ¶
ReadUint64 reads a uint64 from r.
func Size ¶
func Size(v interface{}) uintptr
Size calculates the buffer sized needed by Marshal or Unmarshal.
Size only support the types supported by Marshal.
func Unmarshal ¶
Unmarshal unpacks buf into data.
data must be a slice or a pointer and buf must have a length of exactly Size(data). data must only contain fixed-length signed and unsigned ints, arrays, slices, structs and compositions of said types.
func WriteUint16 ¶
WriteUint16 writes a uint16 to w.
func WriteUint32 ¶
WriteUint32 writes a uint32 to w.
Types ¶
This section is empty.