writeHeader

fun writeHeader(out: DataOutput, codec: String, version: Int)

Writes a codec header, which records both a string to identify the file and a version number. This header can be parsed and validated with .checkHeader.

CodecHeader --> Magic,CodecName,Version

  • Magic -->Uint32. This identifies the start of the header. It is always {@value #CODEC_MAGIC}.

  • CodecName -->String. This is a string to identify this file.

  • Version -->Uint32. Records the version of the file.

Note that the length of a codec header depends only upon the name of the codec, so this length can be computed at any time with .headerLength.

Parameters

out

Output stream

codec

String to identify this file. It should be simple ASCII, less than 128 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