Documentation
¶
Overview ¶
Package binary provides utilities for reading binary data from ROM and disc images.
Index ¶
- func BytesEqual(a, b []byte) bool
- func CleanString(data []byte) string
- func ExtractPrintable(b []byte) string
- func FindBytes(haystack, needle []byte) int
- func FindBytesInRange(reader io.ReaderAt, start, end int64, needle []byte) (int64, error)
- func ReadAt(r io.ReaderAt, offset int64, buf []byte) error
- func ReadBytesAt(r io.ReaderAt, offset int64, n int) ([]byte, error)
- func ReadPrintableStringAt(r io.ReaderAt, offset int64, n int) (string, error)
- func ReadStringAt(r io.ReaderAt, offset int64, n int) (string, error)
- func ReadUint8At(r io.ReaderAt, offset int64) (uint8, error)
- func ReadUint16BEAt(r io.ReaderAt, offset int64) (uint16, error)
- func ReadUint16LEAt(r io.ReaderAt, offset int64) (uint16, error)
- func ReadUint32BEAt(r io.ReaderAt, offset int64) (uint32, error)
- func ReadUint32LEAt(r io.ReaderAt, offset int64) (uint32, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesEqual ¶
BytesEqual compares two byte slices for equality.
func CleanString ¶
CleanString converts bytes to a string, trimming null bytes and whitespace.
func ExtractPrintable ¶
ExtractPrintable extracts only printable ASCII characters (0x20-0x7E) from bytes.
func FindBytes ¶
FindBytes searches for needle in haystack and returns the offset, or -1 if not found.
func FindBytesInRange ¶
FindBytesInRange searches for needle in reader between start and end offsets. Returns the absolute offset or -1 if not found.
func ReadBytesAt ¶
ReadBytesAt reads n bytes from r at offset.
func ReadPrintableStringAt ¶
ReadPrintableStringAt reads a string keeping only printable ASCII characters.
func ReadStringAt ¶
ReadStringAt reads a string of n bytes from r at offset, trimming null bytes and spaces.
func ReadUint8At ¶
ReadUint8At reads a single byte from r at offset.
func ReadUint16BEAt ¶
ReadUint16BEAt reads a big-endian uint16 from r at offset.
func ReadUint16LEAt ¶
ReadUint16LEAt reads a little-endian uint16 from r at offset.
func ReadUint32BEAt ¶
ReadUint32BEAt reads a big-endian uint32 from r at offset.
Types ¶
This section is empty.