Method CheckHeader
CheckHeader(DataInput, String, Int32, Int32)
Reads and validates a header previously written with WriteHeader(DataOutput, String, Int32).
When reading a file, supply the expected codec
and
an expected version range (minVersion
to maxVersion
).
Declaration
public static int CheckHeader(DataInput in, string codec, int minVersion, int maxVersion)
Parameters
Type | Name | Description |
---|---|---|
DataInput | in | Input stream, positioned at the point where the header was previously written. Typically this is located at the beginning of the file. |
System.String | codec | The expected codec name. |
System.Int32 | minVersion | The minimum supported expected version number. |
System.Int32 | maxVersion | The maximum supported expected version number. |
Returns
Type | Description |
---|---|
System.Int32 | The actual version found, when a valid header is found
that matches |
Exceptions
Type | Condition |
---|---|
CorruptIndexException | If the first four bytes are not
CODEC_MAGIC, or if the actual codec found is
not |
IndexFormatTooOldException | If the actual version is less
than |
IndexFormatTooNewException | If the actual version is greater
than |