binary

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package binary provides utilities for reading binary data from ROM and disc images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesEqual

func BytesEqual(a, b []byte) bool

BytesEqual compares two byte slices for equality.

func CleanString

func CleanString(data []byte) string

CleanString converts bytes to a string, trimming null bytes and whitespace.

func ExtractPrintable

func ExtractPrintable(b []byte) string

ExtractPrintable extracts only printable ASCII characters (0x20-0x7E) from bytes.

func FindBytes

func FindBytes(haystack, needle []byte) int

FindBytes searches for needle in haystack and returns the offset, or -1 if not found.

func FindBytesInRange

func FindBytesInRange(reader io.ReaderAt, start, end int64, needle []byte) (int64, error)

FindBytesInRange searches for needle in reader between start and end offsets. Returns the absolute offset or -1 if not found.

func ReadAt

func ReadAt(r io.ReaderAt, offset int64, buf []byte) error

ReadAt reads len(buf) bytes from r at offset.

func ReadBytesAt

func ReadBytesAt(r io.ReaderAt, offset int64, n int) ([]byte, error)

ReadBytesAt reads n bytes from r at offset.

func ReadPrintableStringAt

func ReadPrintableStringAt(r io.ReaderAt, offset int64, n int) (string, error)

ReadPrintableStringAt reads a string keeping only printable ASCII characters.

func ReadStringAt

func ReadStringAt(r io.ReaderAt, offset int64, n int) (string, error)

ReadStringAt reads a string of n bytes from r at offset, trimming null bytes and spaces.

func ReadUint8At

func ReadUint8At(r io.ReaderAt, offset int64) (uint8, error)

ReadUint8At reads a single byte from r at offset.

func ReadUint16BEAt

func ReadUint16BEAt(r io.ReaderAt, offset int64) (uint16, error)

ReadUint16BEAt reads a big-endian uint16 from r at offset.

func ReadUint16LEAt

func ReadUint16LEAt(r io.ReaderAt, offset int64) (uint16, error)

ReadUint16LEAt reads a little-endian uint16 from r at offset.

func ReadUint32BEAt

func ReadUint32BEAt(r io.ReaderAt, offset int64) (uint32, error)

ReadUint32BEAt reads a big-endian uint32 from r at offset.

func ReadUint32LEAt

func ReadUint32LEAt(r io.ReaderAt, offset int64) (uint32, error)

ReadUint32LEAt reads a little-endian uint32 from r at offset.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL