Lucene.Net.Codecs.CodecUtil.CheckHeader C# (CSharp) Метод

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
        public static int CheckHeader(DataInput @in, string codec, int minVersion, int maxVersion)
        {
            // Safety to guard against reading a bogus string:
            int actualHeader = @in.ReadInt();
            if (actualHeader != CODEC_MAGIC)
            {
                throw new Exception("codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CODEC_MAGIC + " (resource: " + @in + ")");
            }
            return CheckHeaderNoMagic(@in, codec, minVersion, maxVersion);
        }