Documentation ¶
Index ¶
- func ReadByte(r io.Reader, p []byte) (byte, error)
- func ReadInt16(r io.Reader, e binary.ByteOrder, p []byte) (int16, error)
- func ReadInt32(r io.Reader, e binary.ByteOrder, p []byte) (int32, error)
- func ReadInt64(r io.Reader, e binary.ByteOrder, p []byte) (int64, error)
- func ReadInt8(r io.Reader, p []byte) (int8, error)
- func ReadUint16(r io.Reader, e binary.ByteOrder, p []byte) (uint16, error)
- func ReadUint32(r io.Reader, e binary.ByteOrder, p []byte) (uint32, error)
- func ReadUint64(r io.Reader, e binary.ByteOrder, p []byte) (uint64, error)
- func ReadUint8(r io.Reader, p []byte) (uint8, error)
- func WriteByte(w io.Writer, b byte, p []byte) error
- func WriteInt16(w io.Writer, e binary.ByteOrder, m int16, p []byte) error
- func WriteInt32(w io.Writer, e binary.ByteOrder, m int32, p []byte) error
- func WriteInt64(w io.Writer, e binary.ByteOrder, m int64, p []byte) error
- func WriteInt8(w io.Writer, m int8, p []byte) error
- func WriteUint16(w io.Writer, e binary.ByteOrder, m uint16, p []byte) error
- func WriteUint32(w io.Writer, e binary.ByteOrder, m uint32, p []byte) error
- func WriteUint64(w io.Writer, e binary.ByteOrder, m uint64, p []byte) error
- func WriteUint8(w io.Writer, m uint8, p []byte) error
- type BasicReader
- type BasicWriter
- type BinaryReadWriter
- type BinaryReader
- type BinaryWriter
- type ByteOrderer
- type Conn
- type ConnReadWriteCloser
- type ConnReader
- type ConnWriter
- type ReadCloser
- func (r *ReadCloser) ByteOrder() binary.ByteOrder
- func (r *ReadCloser) Close() error
- func (r ReadCloser) Read(b []byte) (int, error)
- func (r ReadCloser) ReadByte() (byte, error)
- func (r ReadCloser) ReadInt16() (int16, error)
- func (r ReadCloser) ReadInt32() (int32, error)
- func (r ReadCloser) ReadInt64() (int64, error)
- func (r ReadCloser) ReadInt8() (int8, error)
- func (r ReadCloser) ReadUint16() (uint16, error)
- func (r ReadCloser) ReadUint32() (uint32, error)
- func (r ReadCloser) ReadUint64() (uint64, error)
- func (r ReadCloser) ReadUint8() (uint8, error)
- type ReadWriteCloser
- func (rw *ReadWriteCloser) ByteOrder() binary.ByteOrder
- func (rw *ReadWriteCloser) Close() error
- func (r ReadWriteCloser) Read(b []byte) (int, error)
- func (r ReadWriteCloser) ReadByte() (byte, error)
- func (r ReadWriteCloser) ReadInt16() (int16, error)
- func (r ReadWriteCloser) ReadInt32() (int32, error)
- func (r ReadWriteCloser) ReadInt64() (int64, error)
- func (r ReadWriteCloser) ReadInt8() (int8, error)
- func (r ReadWriteCloser) ReadUint16() (uint16, error)
- func (r ReadWriteCloser) ReadUint32() (uint32, error)
- func (r ReadWriteCloser) ReadUint64() (uint64, error)
- func (r ReadWriteCloser) ReadUint8() (uint8, error)
- func (w ReadWriteCloser) Write(b []byte) (int, error)
- func (w ReadWriteCloser) WriteByte(b byte) error
- func (w ReadWriteCloser) WriteInt16(m int16) error
- func (w ReadWriteCloser) WriteInt32(m int32) error
- func (w ReadWriteCloser) WriteInt64(m int64) error
- func (w ReadWriteCloser) WriteInt8(m int8) error
- func (w ReadWriteCloser) WriteUint16(m uint16) error
- func (w ReadWriteCloser) WriteUint32(m uint32) error
- func (w ReadWriteCloser) WriteUint64(m uint64) error
- func (w ReadWriteCloser) WriteUint8(m uint8) error
- type ReadWriter
- func (rw *ReadWriter) ByteOrder() binary.ByteOrder
- func (r ReadWriter) Read(b []byte) (int, error)
- func (r ReadWriter) ReadByte() (byte, error)
- func (r ReadWriter) ReadInt16() (int16, error)
- func (r ReadWriter) ReadInt32() (int32, error)
- func (r ReadWriter) ReadInt64() (int64, error)
- func (r ReadWriter) ReadInt8() (int8, error)
- func (r ReadWriter) ReadUint16() (uint16, error)
- func (r ReadWriter) ReadUint32() (uint32, error)
- func (r ReadWriter) ReadUint64() (uint64, error)
- func (r ReadWriter) ReadUint8() (uint8, error)
- func (w ReadWriter) Write(b []byte) (int, error)
- func (w ReadWriter) WriteByte(b byte) error
- func (w ReadWriter) WriteInt16(m int16) error
- func (w ReadWriter) WriteInt32(m int32) error
- func (w ReadWriter) WriteInt64(m int64) error
- func (w ReadWriter) WriteInt8(m int8) error
- func (w ReadWriter) WriteUint16(m uint16) error
- func (w ReadWriter) WriteUint32(m uint32) error
- func (w ReadWriter) WriteUint64(m uint64) error
- func (w ReadWriter) WriteUint8(m uint8) error
- type Reader
- func (r *Reader) ByteOrder() binary.ByteOrder
- func (r Reader) Read(b []byte) (int, error)
- func (r Reader) ReadByte() (byte, error)
- func (r Reader) ReadInt16() (int16, error)
- func (r Reader) ReadInt32() (int32, error)
- func (r Reader) ReadInt64() (int64, error)
- func (r Reader) ReadInt8() (int8, error)
- func (r Reader) ReadUint16() (uint16, error)
- func (r Reader) ReadUint32() (uint32, error)
- func (r Reader) ReadUint64() (uint64, error)
- func (r Reader) ReadUint8() (uint8, error)
- type WriteCloser
- func (w *WriteCloser) ByteOrder() binary.ByteOrder
- func (w *WriteCloser) Close() error
- func (w WriteCloser) Write(b []byte) (int, error)
- func (w WriteCloser) WriteByte(b byte) error
- func (w WriteCloser) WriteInt16(m int16) error
- func (w WriteCloser) WriteInt32(m int32) error
- func (w WriteCloser) WriteInt64(m int64) error
- func (w WriteCloser) WriteInt8(m int8) error
- func (w WriteCloser) WriteUint16(m uint16) error
- func (w WriteCloser) WriteUint32(m uint32) error
- func (w WriteCloser) WriteUint64(m uint64) error
- func (w WriteCloser) WriteUint8(m uint8) error
- type Writer
- func (w *Writer) ByteOrder() binary.ByteOrder
- func (w Writer) Write(b []byte) (int, error)
- func (w Writer) WriteByte(b byte) error
- func (w Writer) WriteInt16(m int16) error
- func (w Writer) WriteInt32(m int32) error
- func (w Writer) WriteInt64(m int64) error
- func (w Writer) WriteInt8(m int8) error
- func (w Writer) WriteUint16(m uint16) error
- func (w Writer) WriteUint32(m uint32) error
- func (w Writer) WriteUint64(m uint64) error
- func (w Writer) WriteUint8(m uint8) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadByte ¶
ReadByte reads a byte from the io.Reader r using the slice p for temporary storage. The slice p must be of length at least 1, otherwise an io.ErrShortBuffer error will be returned. Note that this will NOT check to see if r satisfies the io.ByteReader interface.
func ReadInt16 ¶
ReadInt16 reads an int16 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 2, otherwise an io.ErrShortBuffer error will be returned.
func ReadInt32 ¶
ReadInt32 reads an int32 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 4, otherwise an io.ErrShortBuffer error will be returned.
func ReadInt64 ¶
ReadInt64 reads an int64 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 8, otherwise an io.ErrShortBuffer error will be returned.
func ReadInt8 ¶
ReadInt8 reads an int8 from the io.Reader r using the slice p for temporary storage. The slice p must be of length at least 1, otherwise an io.ErrShortBuffer error will be returned.
func ReadUint16 ¶
ReadUint16 reads a uint16 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 2, otherwise an io.ErrShortBuffer error will be returned.
func ReadUint32 ¶
ReadUint32 reads a uint32 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 4, otherwise an io.ErrShortBuffer error will be returned.
func ReadUint64 ¶
ReadUint64 reads a uint64 from the io.Reader r with byte order e, using the slice p for temporary storage. The slice p must be of length at least 8, otherwise an io.ErrShortBuffer error will be returned.
func ReadUint8 ¶
ReadUint8 reads a uint8 from the io.Reader r using the slice p for temporary storage. The slice p must be of length at least 1, otherwise an io.ErrShortBuffer error will be returned.
func WriteByte ¶
WriteByte write the byte b to the io.Writer w using the slice p for temporary storage. The slice p must be of length at least 1, otherwise an io.ErrShortBuffer error will be returned. Note that this will NOT check to see if w satisfies the io.ByteWriter interface.
func WriteInt16 ¶
WriteInt16 writes the int16 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 2, otherwise an io.ErrShortBuffer error will be returned.
func WriteInt32 ¶
WriteInt32 writes the int32 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 4, otherwise an io.ErrShortBuffer error will be returned.
func WriteInt64 ¶
WriteInt64 writes the int64 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 8, otherwise an io.ErrShortBuffer error will be returned.
func WriteInt8 ¶
WriteInt8 writes the int8 m to the io.Writer w using the slice p for temporary storage. The slice p must be of length at least 1, otherwise an io.ErrShortBuffer error will be returned.
func WriteUint16 ¶
WriteUint16 writes the uint16 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 2, otherwise an io.ErrShortBuffer error will be returned.
func WriteUint32 ¶
WriteUint32 writes the uint32 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 4, otherwise an io.ErrShortBuffer error will be returned.
func WriteUint64 ¶
WriteUint64 writes the uint64 m to the io.Writer w using the byte order e and the slice p for temporary storage. The slice p must be of length at least 8, otherwise an io.ErrShortBuffer error will be returned.
Types ¶
type BasicReader ¶
type BasicReader interface { io.ByteReader ReadUint8() (uint8, error) // ReadUint8 reads a uint8. ReadInt8() (int8, error) // ReadInt8 reads an int8. ReadUint16() (uint16, error) // ReadUint16 reads a uint16. ReadInt16() (int16, error) // ReadInt16 reads an int16. ReadUint32() (uint32, error) // ReadUint32 reads a uint32. ReadInt32() (int32, error) // ReadInt32 reads an int32. ReadUint64() (uint64, error) // ReadUint64 reads a uint64. ReadInt64() (int64, error) // ReadInt64 reads an int64. }
BasicReader describes the interface for the basic methods to read binary data.
type BasicWriter ¶
type BasicWriter interface { io.ByteWriter WriteUint8(m uint8) error // WriteUint8 writes a uint8. WriteInt8(m int8) error // WriteInt8 writes an int8. WriteUint16(m uint16) error // WriteUint16 writes a uint16. WriteInt16(m int16) error // WriteInt16 writes an int16. WriteUint32(m uint32) error // WriteUint32 writes a uint32. WriteInt32(m int32) error // WriteInt32 writes an int32. WriteUint64(m uint64) error // WriteUint64 writes a uint64. WriteInt64(m int64) error // WriteInt64 writes an int64. }
BasicWriter describes the interface for the basic methods to write binary data.
type BinaryReadWriter ¶
type BinaryReadWriter interface { io.ReadWriter ByteOrderer BasicReader BasicWriter }
BinaryReadWriter describes the interface for methods to read and write binary data.
type BinaryReader ¶
type BinaryReader interface { io.Reader ByteOrderer BasicReader }
BinaryReader describes the interface for methods to read binary data.
type BinaryWriter ¶
type BinaryWriter interface { io.Writer ByteOrderer BasicWriter }
BinaryWriter describes the interface for methods to write binary data.
type ByteOrderer ¶
type ByteOrderer interface {
ByteOrder() binary.ByteOrder // ByteOrder returns the byte order used.
}
ByteOrderer is the interface satisfied by the ByteOrder method.
type Conn ¶
type Conn interface { net.Conn ByteOrderer BasicReader BasicWriter }
Conn is the interface encapsulating both the net.Conn and BinaryReadWriter interfaces.
type ConnReadWriteCloser ¶
type ConnReadWriteCloser interface { net.Conn ByteOrderer BasicReader BasicWriter CloseRead() error // CloseRead shuts down the reading side of the connection. Most callers should just use Close. CloseWrite() error // CloseWrite shuts down the writing side of the connection. Most callers should just use Close. }
ConnReadWriteCloser is the interface encapsulating both the ConnReadWriteCloser and BinaryReadWriter interfaces.
func NewConnReadWriteCloser ¶
func NewConnReadWriteCloser(c ConnReadWriteCloser, e binary.ByteOrder) ConnReadWriteCloser
NewConnReadWriteCloser wraps the given ConnReadWriteCloser and binary.ByteOrder as a ConnReadWriteCloser.
type ConnReader ¶
type ConnReader interface { io.Reader ByteOrderer BasicReader SetReadDeadline(t time.Time) error // SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out. LocalAddr() net.Addr // LocalAddr returns the local network address. RemoteAddr() net.Addr // RemoteAddr returns the remote network address. }
ConnReader is a subset of the Conn interface, only supporting methods for reading data.
type ConnWriter ¶
type ConnWriter interface { io.Writer ByteOrderer BasicWriter SetWriteDeadline(t time.Time) error // SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out. LocalAddr() net.Addr // LocalAddr returns the local network address. RemoteAddr() net.Addr // RemoteAddr returns the remote network address. }
ConnWriter is a subset of the Conn interface, only supporting methods for writing data.
type ReadCloser ¶
type ReadCloser struct {
// contains filtered or unexported fields
}
ReadCloser wraps an io.ReadCloser and implements BinaryReader.
func NewReadCloser ¶
func NewReadCloser(r io.ReadCloser, e binary.ByteOrder) *ReadCloser
NewReadCloser wraps the given io.ReadCloser as a BinaryReader using the given byte order.
func (*ReadCloser) ByteOrder ¶
func (r *ReadCloser) ByteOrder() binary.ByteOrder
ByteOrder returns the byte order used.
func (ReadCloser) ReadUint16 ¶
ReadUint16 reads a uint16 from r.
func (ReadCloser) ReadUint32 ¶
ReadUint32 reads a uint32 from r.
func (ReadCloser) ReadUint64 ¶
ReadUint64 reads a uint64 from r.
type ReadWriteCloser ¶
type ReadWriteCloser struct {
// contains filtered or unexported fields
}
ReadWriteCloser wraps an io.ReadWriteCloser and implements BinaryReader and BinaryWriter.
func NewReadWriteCloser ¶
func NewReadWriteCloser(rw io.ReadWriteCloser, e binary.ByteOrder) *ReadWriteCloser
NewReadWriteCloser wraps the given io.ReadWriteCloser as a BinaryReader and BinaryWriter using the given byte order.
func (*ReadWriteCloser) ByteOrder ¶
func (rw *ReadWriteCloser) ByteOrder() binary.ByteOrder
ByteOrder returns the byte order used.
func (*ReadWriteCloser) Close ¶
func (rw *ReadWriteCloser) Close() error
Close closes the underlying writer.
func (ReadWriteCloser) ReadUint16 ¶
ReadUint16 reads a uint16 from r.
func (ReadWriteCloser) ReadUint32 ¶
ReadUint32 reads a uint32 from r.
func (ReadWriteCloser) ReadUint64 ¶
ReadUint64 reads a uint64 from r.
func (ReadWriteCloser) WriteInt16 ¶
WriteInt16 writes an int16 to w.
func (ReadWriteCloser) WriteInt32 ¶
WriteInt32 writes an int32 to w.
func (ReadWriteCloser) WriteInt64 ¶
WriteInt64 writes an int64 to w.
func (ReadWriteCloser) WriteUint16 ¶
WriteUint16 writes a uint16 to w.
func (ReadWriteCloser) WriteUint32 ¶
WriteUint32 writes a uint32 to w.
func (ReadWriteCloser) WriteUint64 ¶
WriteUint64 writes a uint64 to w.
func (ReadWriteCloser) WriteUint8 ¶
WriteUint8 writes a uint8 to w
type ReadWriter ¶
type ReadWriter struct {
// contains filtered or unexported fields
}
ReadWriter wraps an io.ReadWriter and implements BinaryReader and BinaryWriter.
func NewReadWriter ¶
func NewReadWriter(rw io.ReadWriter, e binary.ByteOrder) *ReadWriter
NewReadWriter wraps the given io.ReadWriter as a BinaryReader and BinaryWriter using the given byte order.
func (*ReadWriter) ByteOrder ¶
func (rw *ReadWriter) ByteOrder() binary.ByteOrder
ByteOrder returns the byte order used.
func (ReadWriter) ReadUint16 ¶
ReadUint16 reads a uint16 from r.
func (ReadWriter) ReadUint32 ¶
ReadUint32 reads a uint32 from r.
func (ReadWriter) ReadUint64 ¶
ReadUint64 reads a uint64 from r.
func (ReadWriter) WriteInt16 ¶
WriteInt16 writes an int16 to w.
func (ReadWriter) WriteInt32 ¶
WriteInt32 writes an int32 to w.
func (ReadWriter) WriteInt64 ¶
WriteInt64 writes an int64 to w.
func (ReadWriter) WriteUint16 ¶
WriteUint16 writes a uint16 to w.
func (ReadWriter) WriteUint32 ¶
WriteUint32 writes a uint32 to w.
func (ReadWriter) WriteUint64 ¶
WriteUint64 writes a uint64 to w.
func (ReadWriter) WriteUint8 ¶
WriteUint8 writes a uint8 to w
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps an io.Reader and implements BinaryReader.
func (Reader) ReadUint16 ¶
ReadUint16 reads a uint16 from r.
func (Reader) ReadUint32 ¶
ReadUint32 reads a uint32 from r.
func (Reader) ReadUint64 ¶
ReadUint64 reads a uint64 from r.
type WriteCloser ¶
type WriteCloser struct {
// contains filtered or unexported fields
}
WriteCloser wraps an io.WriteCloser and implements BinaryWriter.
func NewWriteCloser ¶
func NewWriteCloser(w io.WriteCloser, e binary.ByteOrder) *WriteCloser
NewWriteCloser wraps the given io.WriteCloser as a BinaryWriter using the given byte order.
func (*WriteCloser) ByteOrder ¶
func (w *WriteCloser) ByteOrder() binary.ByteOrder
ByteOrder returns the byte order used.
func (WriteCloser) WriteInt16 ¶
WriteInt16 writes an int16 to w.
func (WriteCloser) WriteInt32 ¶
WriteInt32 writes an int32 to w.
func (WriteCloser) WriteInt64 ¶
WriteInt64 writes an int64 to w.
func (WriteCloser) WriteUint16 ¶
WriteUint16 writes a uint16 to w.
func (WriteCloser) WriteUint32 ¶
WriteUint32 writes a uint32 to w.
func (WriteCloser) WriteUint64 ¶
WriteUint64 writes a uint64 to w.
func (WriteCloser) WriteUint8 ¶
WriteUint8 writes a uint8 to w
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer wraps an io.Writer and implements BinaryWriter.
func (Writer) WriteInt16 ¶
WriteInt16 writes an int16 to w.
func (Writer) WriteInt32 ¶
WriteInt32 writes an int32 to w.
func (Writer) WriteInt64 ¶
WriteInt64 writes an int64 to w.
func (Writer) WriteUint16 ¶
WriteUint16 writes a uint16 to w.
func (Writer) WriteUint32 ¶
WriteUint32 writes a uint32 to w.
func (Writer) WriteUint64 ¶
WriteUint64 writes a uint64 to w.