C# 클래스 Lucene.Net.Codecs.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

파일 보기 프로젝트 열기: paulirwin/lucene.net

공개 프로퍼티들

프로퍼티 타입 설명
FOOTER_MAGIC int

공개 메소드들

메소드 설명
CheckEOF ( IndexInput @in ) : void

Checks that the stream is positioned at the end, and throws exception if it is not.

CheckFooter ( Lucene.Net.Store.ChecksumIndexInput @in ) : long

Validates the codec footer previously written by #writeFooter.

CheckHeader ( DataInput @in, string codec, int minVersion, int maxVersion ) : int

Reads and validates a header previously written with #writeHeader(DataOutput, String, int).

When reading a file, supply the expected codec and an expected version range (minVersion to maxVersion).

CheckHeaderNoMagic ( DataInput @in, string codec, int minVersion, int maxVersion ) : int

Like {@link #checkHeader(DataInput,String,int,int)} except this version assumes the first int has already been read and validated from the input.

ChecksumEntireFile ( IndexInput input ) : long

Clones the provided input, reads all bytes from the file, and calls #checkFooter

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.

FooterLength ( ) : int

Computes the length of a codec footer.

HeaderLength ( string codec ) : int

Computes the length of a codec header.

RetrieveChecksum ( IndexInput @in ) : long

Returns (but does not validate) the checksum previously written by #checkFooter.

WriteFooter ( Lucene.Net.Store.IndexOutput @out ) : void

Writes a codec footer, which records both a checksum algorithm ID and a checksum. this footer can be parsed and validated with #checkFooter(ChecksumIndexInput) checkFooter().

CodecFooter --> Magic,AlgorithmID,Checksum

  • Magic --> DataOutput#writeInt Uint32. this identifies the start of the footer. It is always {@value #FOOTER_MAGIC}.
  • AlgorithmID --> DataOutput#writeInt Uint32. this indicates the checksum algorithm used. Currently this is always 0, for zlib-crc32.
  • Checksum --> DataOutput#writeLong Uint32. The actual checksum value for all previous bytes in the stream, including the bytes from Magic and AlgorithmID.

WriteHeader ( DataOutput @out, string codec, int version ) : void

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, int, int) checkHeader().

CodecHeader --> Magic,CodecName,Version

  • Magic --> DataOutput#writeInt Uint32. this identifies the start of the header. It is always {@value #CODEC_MAGIC}.
  • CodecName --> DataOutput#writeString String. this is a string to identify this file.
  • Version --> DataOutput#writeInt 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(String).

비공개 메소드들

메소드 설명
CodecUtil ( ) : Lucene.Net.Store
ValidateFooter ( IndexInput @in ) : void

메소드 상세

CheckEOF() 공개 정적인 메소드

Checks that the stream is positioned at the end, and throws exception if it is not.
public static CheckEOF ( IndexInput @in ) : void
@in Lucene.Net.Store.IndexInput
리턴 void

CheckFooter() 공개 정적인 메소드

Validates the codec footer previously written by #writeFooter.
if the footer is invalid, if the checksum does not match, /// or if {@code in} is not properly positioned before the footer /// at the end of the stream.
public static CheckFooter ( Lucene.Net.Store.ChecksumIndexInput @in ) : long
@in Lucene.Net.Store.ChecksumIndexInput
리턴 long

CheckHeader() 공개 정적인 메소드

Reads and validates a header previously written with #writeHeader(DataOutput, String, int).

When reading a file, supply the expected codec and an expected version range (minVersion to maxVersion).

If the first four bytes are not /// , or if the actual codec found is /// not codec. If the actual version is less /// than minVersion. If the actual version is greater /// than maxVersion. If there is an I/O error reading from the underlying medium.
public static CheckHeader ( DataInput @in, string codec, int minVersion, int maxVersion ) : int
@in Lucene.Net.Store.DataInput
codec string The expected codec name.
minVersion int The minimum supported expected version number.
maxVersion int The maximum supported expected version number.
리턴 int

CheckHeaderNoMagic() 공개 정적인 메소드

Like {@link #checkHeader(DataInput,String,int,int)} except this version assumes the first int has already been read and validated from the input.
public static CheckHeaderNoMagic ( DataInput @in, string codec, int minVersion, int maxVersion ) : int
@in Lucene.Net.Store.DataInput
codec string
minVersion int
maxVersion int
리턴 int

ChecksumEntireFile() 공개 정적인 메소드

Clones the provided input, reads all bytes from the file, and calls #checkFooter

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.

public static ChecksumEntireFile ( IndexInput input ) : long
input Lucene.Net.Store.IndexInput
리턴 long

FooterLength() 공개 정적인 메소드

Computes the length of a codec footer.
public static FooterLength ( ) : int
리턴 int

HeaderLength() 공개 정적인 메소드

Computes the length of a codec header.
public static HeaderLength ( string codec ) : int
codec string Codec name.
리턴 int

RetrieveChecksum() 공개 정적인 메소드

Returns (but does not validate) the checksum previously written by #checkFooter.
if the footer is invalid
public static RetrieveChecksum ( IndexInput @in ) : long
@in Lucene.Net.Store.IndexInput
리턴 long

WriteFooter() 공개 정적인 메소드

Writes a codec footer, which records both a checksum algorithm ID and a checksum. this footer can be parsed and validated with #checkFooter(ChecksumIndexInput) checkFooter().

CodecFooter --> Magic,AlgorithmID,Checksum

  • Magic --> DataOutput#writeInt Uint32. this identifies the start of the footer. It is always {@value #FOOTER_MAGIC}.
  • AlgorithmID --> DataOutput#writeInt Uint32. this indicates the checksum algorithm used. Currently this is always 0, for zlib-crc32.
  • Checksum --> DataOutput#writeLong Uint32. The actual checksum value for all previous bytes in the stream, including the bytes from Magic and AlgorithmID.
If there is an I/O error writing to the underlying medium.
public static WriteFooter ( Lucene.Net.Store.IndexOutput @out ) : void
@out Lucene.Net.Store.IndexOutput
리턴 void

WriteHeader() 공개 정적인 메소드

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, int, int) checkHeader().

CodecHeader --> Magic,CodecName,Version

  • Magic --> DataOutput#writeInt Uint32. this identifies the start of the header. It is always {@value #CODEC_MAGIC}.
  • CodecName --> DataOutput#writeString String. this is a string to identify this file.
  • Version --> DataOutput#writeInt 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(String).

If there is an I/O error writing to the underlying medium.
public static WriteHeader ( DataOutput @out, string codec, int version ) : void
@out Lucene.Net.Store.DataOutput
codec string String to identify this file. It should be simple ASCII, /// less than 128 characters in length.
version int Version number
리턴 void

프로퍼티 상세

FOOTER_MAGIC 공개적으로 정적으로 프로퍼티

Constant to identify the start of a codec footer.
public static int FOOTER_MAGIC
리턴 int