Lucene.Net.Store.DataInput.ReadInt C# (CSharp) Method

ReadInt() public method

Reads four bytes and returns an int.
public ReadInt ( ) : int
return int
        public virtual int ReadInt()
        {
            return ((ReadByte() & 0xFF) << 24) | ((ReadByte() & 0xFF) << 16) | ((ReadByte() & 0xFF) << 8) | (ReadByte() & 0xFF);
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Like {@link
        ///  #checkHeader(DataInput,String,int,int)} except this
        ///  version assumes the first int has already been read
        ///  and validated from the input.
        /// </summary>
        public static int CheckHeaderNoMagic(DataInput @in, string codec, int minVersion, int maxVersion)
        {
            string actualCodec = @in.ReadString();
            if (!actualCodec.Equals(codec))
            {
                throw new System.IO.IOException("codec mismatch: actual codec=" + actualCodec + " vs expected codec=" + codec + " (resource: " + @in + ")");
            }

            int actualVersion = @in.ReadInt();
            if (actualVersion < minVersion)
            {
                throw new System.IO.IOException("Version: " + actualVersion + " is not supported. Minimum Version number is " + minVersion + ".");
            }
            if (actualVersion > maxVersion)
            {
                throw new System.IO.IOException("Version: " + actualVersion + " is not supported. Maximum Version number is " + maxVersion + ".");
            }

            return actualVersion;
        }
All Usage Examples Of Lucene.Net.Store.DataInput::ReadInt