BinaryReader

Overview

BinaryReader is a class in Aspose.Font FOSS for Python.

Wraps a byte source in seekable BytesIO for big-endian font binary parsing.

This class provides 20 methods for working with BinaryReader objects in Python programs. Available methods include: __init__, read_bytes, read_cstring, read_f2dot14, read_fixed, read_i16, read_i16_le, read_i32, read_i8, read_pascal_string, read_tag, read_u16, and 8 additional methods. All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package.

Methods

SignatureDescription
__init__(source: bytes | io.IOBase)Calls init on this BinaryReader instance.
tell() → intReturns the current byte offset within the stream
seek(offset: int, whence: int)Moves the read cursor to the given offset using the specified whence
remaining() → intReturns the number of unread bytes left in the stream
read_u8() → intReads an unsigned 8‑bit integer and returns it as int
read_u16() → intReads a big‑endian unsigned 16‑bit integer from the underlying byte source and advances the read cursor
read_u16_le() → intReads a little‑endian unsigned 16‑bit integer
read_u32() → intReads a big‑endian unsigned 32‑bit integer
read_u32_le() → intReads a little‑endian unsigned 32‑bit integer
read_u64() → intReads a big‑endian unsigned 64‑bit integer
read_i8() → intReads a signed 8‑bit integer
read_i16() → intReads a big‑endian signed 16‑bit integer
read_i16_le() → intReads a little‑endian signed 16‑bit integer
read_i32() → intReads a big‑endian signed 32‑bit integer
read_fixed() → float16.16 fixed-point → float.
read_f2dot14() → float2.14 fixed-point → float.
read_bytes(n: int) → bytesReads n bytes from the stream and returns them as bytes
read_tag() → strRead a 4-byte ASCII tag (e.g.
read_pascal_string() → strRead a Pascal-style length-prefixed string.
read_cstring() → strRead a null-terminated C string.

See Also

 English