Documentation ¶
Overview ¶
Package binio provides high-performance functionality for binary IO.
The package is currently thread-unsafe, even when writing to different writers.
Index ¶
- func GetBit(b []byte, n int) int
- func GetHalfByte(b []byte, n int) byte
- func ReadByte(r io.Reader) (byte, error)
- func ReadBytes(r io.Reader) ([]byte, error)
- func ReadString(r io.Reader) (string, error)
- func ReadUint64(r io.Reader) (uint64, error)
- func ReadUvarint(r io.Reader) (uint64, error)
- func SetBit(b []byte, n, v int)
- func SetHalfByte(b []byte, n int, v byte)
- func Uint64FromBytes(b []byte) uint64
- func Uint64ToBytes(x uint64, b []byte)
- func WriteByte(w io.Writer, b byte) error
- func WriteBytes(w io.Writer, b []byte) error
- func WriteString(w io.Writer, s string) error
- func WriteUint64(w io.Writer, x uint64) error
- func WriteUvarint(w io.Writer, x uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHalfByte ¶
GetHalfByte returns the value of the n'th half byte (4 bits) in a byte slice.
func ReadByte ¶
ReadByte reads a byte from the given writer. Saves the need to create and keep a buffer for reading.
func ReadString ¶
ReadString reads a string from the given writer.
func ReadUint64 ¶
ReadUint64 reads a uint64 from the given reader.
func ReadUvarint ¶
ReadUvarint reads a varint-encoded uint64 from the given reader.
func SetHalfByte ¶
SetHalfByte sets the value of the n'th half byte (4 bits) in a byte slice.
func Uint64FromBytes ¶
Uint64FromBytes returns the number represented by the given slice.
func Uint64ToBytes ¶
Uint64ToBytes populates the first 8 bytes in the given slice with the given number.
func WriteByte ¶
WriteByte writes a byte to the given writer. Saves the need to create and keep a buffer for writing.
func WriteBytes ¶
WriteBytes writes a slice of bytes to the given writer.
func WriteString ¶
WriteString writes a string to the given writer.
func WriteUint64 ¶
WriteUint64 writes a uint64 to the given writer.
Types ¶
This section is empty.