Class CodecUtil
Utility class for reading and writing versioned headers.
Writing codec headers is useful to ensure that a file is in the format you think it is.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public sealed class CodecUtil : object
Fields
Name | Description |
---|---|
CODEC_MAGIC | Constant to identify the start of a codec header. |
FOOTER_MAGIC | Constant to identify the start of a codec footer. |
Methods
Name | Description |
---|---|
CheckEOF(IndexInput) | Checks that the stream is positioned at the end, and throws exception if it is not. |
CheckFooter(ChecksumIndexInput) | Validates the codec footer previously written by WriteFooter(IndexOutput). |
CheckHeader(DataInput, String, Int32, Int32) | Reads and validates a header previously written with WriteHeader(DataOutput, String, Int32).
When reading a file, supply the expected |
CheckHeaderNoMagic(DataInput, String, Int32, Int32) | Like
CheckHeader(DataInput, String, Int32, Int32) except this
version assumes the first |
ChecksumEntireFile(IndexInput) | Clones the provided input, reads all bytes from the file, and calls CheckFooter(ChecksumIndexInput) Note that this method may be slow, as it must process the entire file. If you just need to extract the checksum value, call RetrieveChecksum(IndexInput). |
FooterLength() | Computes the length of a codec footer. |
HeaderLength(String) | Computes the length of a codec header. |
RetrieveChecksum(IndexInput) | Returns (but does not validate) the checksum previously written by CheckFooter(ChecksumIndexInput). |
WriteFooter(IndexOutput) | Writes a codec footer, which records both a checksum algorithm ID and a checksum. This footer can be parsed and validated with CheckFooter(ChecksumIndexInput). CodecFooter --> Magic,AlgorithmID,Checksum
|
WriteHeader(DataOutput, String, Int32) | 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(DataInput, String, Int32, Int32). CodecHeader --> Magic,CodecName,Version
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(String). |