writeIndexHeader

fun writeIndexHeader(out: DataOutput, codec: String, version: Int, id: ByteArray, suffix: String)

Writes a codec header for an index file, which records both a string to identify the format of the file, a version number, and data to identify the file instance (ID and auxiliary suffix such as generation).

This header can be parsed and validated with .checkIndexHeader.

IndexHeader --> CodecHeader,ObjectID,ObjectSuffix

  • CodecHeader -->.writeHeader

  • ObjectID -->byte16

  • ObjectSuffix --> SuffixLength,SuffixBytes

  • SuffixLength -->byte

  • SuffixBytes -->byteSuffixLength

Note that the length of an index header depends only upon the name of the codec and suffix, so this length can be computed at any time with .indexHeaderLength.

Parameters

out

Output stream

codec

String to identify the format of this file. It should be simple ASCII, less than 128 characters in length.

id

Unique identifier for this particular file instance.

suffix

auxiliary suffix information for the file. It should be simple ASCII, less than 256 characters in length.

version

Version number

Throws

IOException

If there is an I/O error writing to the underlying medium.

If the codec name is not simple ASCII, or is more than 127 characters in length, or if id is invalid, or if the suffix is not simple ASCII, or more than 255 characters in length.