PostScript binary object format
PostScript binary object format is a binary format for serialization of data structures, and it is produced by the printobject and writeobject operators in PostScript, and can also be read by PostScript.
The first byte is always in range 128 to 131, which indicates endianness and floating point format, where 128 means big-endian integers with native floating numbers, 129 means small-endian integers with native floating numbers, 130 means big-endian integers with big-endian IEEE floating numbers, and 131 means small-endian integers with small-endian IEEE floating numbers. However, due to a bug in Adobe's software (this bug is also emulated in Ghostscript for compatibility), 128 and 129 actually act like 130 and 131 if the native floating point format is IEEE.
After that is the rest of the header, which can be either a short or long header:
- Short header: 8-bit number of objects in top-level array (which must be nonzero), followed by 16-bit overall length in bytes (including the header).
- Long header: Zero (one byte), followed by 16-bit number of objects in top-level array, followed by 32-bit overall length in bytes (including the header).