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
| Signature | Description |
|---|---|
__init__(source: bytes | io.IOBase) | Calls init on this BinaryReader instance. |
tell() → int | Returns 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() → int | Returns the number of unread bytes left in the stream |
read_u8() → int | Reads an unsigned 8‑bit integer and returns it as int |
read_u16() → int | Reads a big‑endian unsigned 16‑bit integer from the underlying byte source and advances the read cursor |
read_u16_le() → int | Reads a little‑endian unsigned 16‑bit integer |
read_u32() → int | Reads a big‑endian unsigned 32‑bit integer |
read_u32_le() → int | Reads a little‑endian unsigned 32‑bit integer |
read_u64() → int | Reads a big‑endian unsigned 64‑bit integer |
read_i8() → int | Reads a signed 8‑bit integer |
read_i16() → int | Reads a big‑endian signed 16‑bit integer |
read_i16_le() → int | Reads a little‑endian signed 16‑bit integer |
read_i32() → int | Reads a big‑endian signed 32‑bit integer |
read_fixed() → float | 16.16 fixed-point → float. |
read_f2dot14() → float | 2.14 fixed-point → float. |
read_bytes(n: int) → bytes | Reads n bytes from the stream and returns them as bytes |
read_tag() → str | Read a 4-byte ASCII tag (e.g. |
read_pascal_string() → str | Read a Pascal-style length-prefixed string. |
read_cstring() → str | Read a null-terminated C string. |