Source/NFX/IOMiscUtils.cs
/// <summary>
/// Reads an integer encoded as big endian from buffer at the specified index
/// </summary>
Reads an integer encoded as big endian from buffer at the specified index
Reads an integer encoded as big endian from buffer at the specified index
public static Int32 ReadBEInt32(this Stream s)
        {
            var b1 = s.ReadByte();
            if (b1<0) throw new IO.NFXIOException(StringConsts.STREAM_READ_EOF_ERROR+"ReadBEInt32()");
            var b2 = s.ReadByte();
            if (b2<0) throw new IO.NFXIOException(StringConsts.STREAM_READ_EOF_ERROR+"ReadBEInt32()");
            var b3 = s.ReadByte();
            if (b3<0) throw new IO.NFXIOException(StringConsts.STREAM_READ_EOF_ERROR+"ReadBEInt32()");
            var b4 = s.ReadByte();
            if (b4<0) throw new IO.NFXIOException(StringConsts.STREAM_READ_EOF_ERROR+"ReadBEInt32()");
            return (b1 << 24) +
                   (b2 << 16) +
                   (b3 << 8 ) +
                   (b4 );
        }
public static Int32 ReadBEInt32 ( this Stream s ) { var b1 = s . ReadByte ( ) ; if ( b1 < 0 ) throw new IO . NFXIOException ( StringConsts . STREAM_READ_EOF_ERROR + " " ) ; var b2 = s . ReadByte ( ) ; if ( b2 < 0 ) throw new IO . NFXIOException ( StringConsts . STREAM_READ_EOF_ERROR + " " ) ; var b3 = s . ReadByte ( ) ; if ( b3 < 0 ) throw new IO . NFXIOException ( StringConsts . STREAM_READ_EOF_ERROR + " " ) ; var b4 = s . ReadByte ( ) ; if ( b4 < 0 ) throw new IO . NFXIOException ( StringConsts . STREAM_READ_EOF_ERROR + " " ) ; return ( b1 << 24 ) + ( b2 << 16 ) + ( b3 << 8 ) + ( b4 ) ; }
Reads an integer encoded as big endian from buffer at the specified index
Reads an integer encoded as big endian from buffer at the specified index
Stream
this