Binary Data

The Wolfram Language provides high-performance reading and writing of binary data, to both files and pipes. A convenient symbolic format representation makes it straightforward to translate published instrumentation or logging specifications to a form that can immediately be used in the Wolfram Language.

BinaryRead read one binary object or block of objects

BinaryReadList repeatedly read a binary object or block of objects

ReadByteArray read raw bytes as a ByteArray object.

BinaryWrite write a sequence of binary objects with specified types

Import, Export import, export complete binary files

Binary Types

"Bit" individual binary bits (Import, Export only)

"Byte" 8-bit unsigned integer

"Integer8", "Integer16", ... 8-, 16-, 24- 32-, 64-, 128-bit signed integers

"UnsignedInteger8", ... 8-, 16-, 24-, 32-, 64-, 128-bit unsigned integers

"Real32", "Real64", "Real128" IEEE single, double, quad-precision real numbers

"Complex64", "Complex128", "Complex256" IEEE complex numbers

"Character8", "Character16" 8- and 16-bit (Unicode) characters

"TerminatedString" null-terminated string

ByteOrdering option for byte ordering (+1 for big endian; -1 for little endian)

$ByteOrdering native byte ordering on your computer system

ToCharacterCode, FromCharacterCode character code conversion

Compress  ▪  Uncompress  ▪  Encrypt  ▪  Decrypt  ▪  Hash

Byte Arrays

ByteArray a raw vector of bytes, stored without interpretation

BaseEncode, BaseDecode convert between a byte array and its Base64 representation

ByteArrayQ  ▪  Normal  ▪  Length  ▪  Part  ▪  First

ByteArrayToString  ▪  StringToByteArray  ▪  ImportByteArray  ▪  ExportByteArray

Numeric Arrays

NumericArray an array of a numeric type, stored in the most compact representation

NumericArrayQ  ▪  NumericArrayType

Binary Representation of Expressions

BinarySerialize  ▪  BinaryDeserialize

Binary Data Formats

"WXF"  ▪  "MX"  ▪  "WDX"  ▪  "UBJSON"  ▪  "BSON"  ▪  "HDF5"  ▪  ...