Field type

Numbers:

  • Bit: one bit (True/False) ;
  • Bits: unsigned number with a size in bits ;
  • Bytes: vector of know bytes (eg. file signature) ;
  • UInt8, UInt16, UInt32, UInt64: unsigned number (size: 8, 16, 32, 64 bits) ;
  • Int8, Int16, Int32, Int64: signed number (size: 8, 16, 32, 64 bits) ;
  • Float32, Float64: 32/64 bits floatting point number (IEEE 754).

Text:

  • Character: 8 bits ASCII character ;
  • String: fixed length string ;
  • CString: string ending with nul byte ("0") ;
  • PascalString?8, PascalString?16, PascalString?32: string prefixed with length in a unsigned 8 / 16 / 32 bits integer (use parent endian).

Tools:

  • Enum: generic class to associate a value to a description (encapsulate another field) ;
  • PaddingBits: padding with a size in bits ;
  • PaddingBytes: padding with a size in bytes ;
  • FieldSet: a ordered list of fields (contains other fields).

If you didn't found documentation about a format, use "raw" types:

  • RawBits: unsigned number with a size in bits ;
  • RawBytes: vector with a size in bytes.

Stream

Input stream

  • InputStream (generic) ;
  • StringInputStream (from a string) ;
  • FileInputStream (from a file).

Output stream

  • OutputStream (generic) ;
  • StringOutputStream (to a string) ;
  • FileOutputStream (to a file).

Endian

"Endian" is the order of bytes in memory/file. Different sort of endian does exist:

Endian Hachoir name String "ABCD" Number 0x1A2B3C4D (1234) CPU
Big endian BIG_ENDIAN ABCD 0x1A 0x2B 0x3C 0x4D (1234) PowerPC, Motorola 68000, System/370
Little endian LITTLE_ENDIAN DCBA 0x4D 0x3C 0x2B 0x1A (4321) Intel x86, VAX
PDP endian PDP_ENDIAN CDAB 0x3C 0x4D 0x1A 0x2B (3412) PDP-11
(other endian) - BADC 0x2B 0x1A 0x4D 0x3D (2143) Is it really used?

Notes:

  • PDP endian is also called "middle endian".
  • PDP_ENDIAN is not supported in Hachoir yet
  • NETWORK_ENDIAN is an alias for BIG_ENDIAN, it's the endian in network packets

See also:

Other Hachoir documentation

Get more documentation on QualityControl page.

Find documentation about formats

See File format resources.