C# 클래스 MiscUtil.IO.EndianBinaryReader

Equivalent of System.IO.BinaryReader, but with either endianness, depending on the EndianBitConverter it is constructed with. No data is buffered in the reader; the client may seek within the stream at will.
상속: IDisposable
파일 보기 프로젝트 열기: jadref/buffer_bci 1 사용 예제들

공개 메소드들

메소드 설명
Close ( ) : void

Closes the reader, including the underlying stream..

Dispose ( ) : void

Disposes of the underlying stream.

EndianBinaryReader ( EndianBitConverter bitConverter, Stream stream ) : System

Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with.

EndianBinaryReader ( EndianBitConverter bitConverter, Stream stream, Encoding encoding ) : System

Constructs a new binary reader with the given bit converter, reading to the given stream, using the given encoding.

Read ( ) : int

Reads a single character from the stream, using the character encoding for this reader. If no characters have been fully read by the time the stream ends, -1 is returned.

Read ( byte buffer, int index, int count ) : int

Reads the specified number of bytes into the given buffer, starting at the given index.

Read ( char data, int index, int count ) : int

Reads the specified number of characters into the given buffer, starting at the given index.

Read7BitEncodedInt ( ) : int

Reads a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter.

ReadBigEndian7BitEncodedInt ( ) : int

Reads a 7-bit encoded integer from the stream. This is stored with the most significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter.

ReadBoolean ( ) : bool

Reads a boolean from the stream. 1 byte is read.

ReadByte ( ) : byte

Reads a single byte from the stream.

ReadBytes ( int count ) : byte[]

Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will return what is available.

ReadBytesOrThrow ( int count ) : byte[]

Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will throw an IOException.

ReadDecimal ( ) : decimal

Reads a decimal value from the stream, using the bit converter for this reader. 16 bytes are read.

ReadDouble ( ) : double

Reads a double-precision floating-point value from the stream, using the bit converter for this reader. 8 bytes are read.

ReadInt16 ( ) : short

Reads a 16-bit signed integer from the stream, using the bit converter for this reader. 2 bytes are read.

ReadInt32 ( ) : int

Reads a 32-bit signed integer from the stream, using the bit converter for this reader. 4 bytes are read.

ReadInt64 ( ) : long

Reads a 64-bit signed integer from the stream, using the bit converter for this reader. 8 bytes are read.

ReadSByte ( ) : sbyte

Reads a single signed byte from the stream.

ReadSingle ( ) : float

Reads a single-precision floating-point value from the stream, using the bit converter for this reader. 4 bytes are read.

ReadString ( int bytesToRead ) : string

Reads a length-prefixed string from the stream, using the encoding for this reader. A 7-bit encoded integer is first read, which specifies the number of bytes to read from the stream. These bytes are then converted into a string with the encoding for this reader.

ReadUInt16 ( ) : ushort

Reads a 16-bit unsigned integer from the stream, using the bit converter for this reader. 2 bytes are read.

ReadUInt32 ( ) : uint

Reads a 32-bit unsigned integer from the stream, using the bit converter for this reader. 4 bytes are read.

ReadUInt64 ( ) : ulong

Reads a 64-bit unsigned integer from the stream, using the bit converter for this reader. 8 bytes are read.

Seek ( int offset, SeekOrigin origin ) : void

Seeks within the stream.

비공개 메소드들

메소드 설명
CheckDisposed ( ) : void

Checks whether or not the reader has been disposed, throwing an exception if so.

ReadInternal ( byte data, int size ) : void

Reads the given number of bytes from the stream, throwing an exception if they can't all be read.

TryReadInternal ( byte data, int size ) : int

Reads the given number of bytes from the stream if possible, returning the number of bytes actually read, which may be less than requested if (and only if) the end of the stream is reached.

메소드 상세

Close() 공개 메소드

Closes the reader, including the underlying stream..
public Close ( ) : void
리턴 void

Dispose() 공개 메소드

Disposes of the underlying stream.
public Dispose ( ) : void
리턴 void

EndianBinaryReader() 공개 메소드

Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with.
public EndianBinaryReader ( EndianBitConverter bitConverter, Stream stream ) : System
bitConverter MiscUtil.Conversion.EndianBitConverter Converter to use when reading data
stream Stream Stream to read data from
리턴 System

EndianBinaryReader() 공개 메소드

Constructs a new binary reader with the given bit converter, reading to the given stream, using the given encoding.
public EndianBinaryReader ( EndianBitConverter bitConverter, Stream stream, Encoding encoding ) : System
bitConverter MiscUtil.Conversion.EndianBitConverter Converter to use when reading data
stream Stream Stream to read data from
encoding System.Text.Encoding Encoding to use when reading character data
리턴 System

Read() 공개 메소드

Reads a single character from the stream, using the character encoding for this reader. If no characters have been fully read by the time the stream ends, -1 is returned.
public Read ( ) : int
리턴 int

Read() 공개 메소드

Reads the specified number of bytes into the given buffer, starting at the given index.
public Read ( byte buffer, int index, int count ) : int
buffer byte The buffer to copy data into
index int The first index to copy data into
count int The number of bytes to read
리턴 int

Read() 공개 메소드

Reads the specified number of characters into the given buffer, starting at the given index.
public Read ( char data, int index, int count ) : int
data char The buffer to copy data into
index int The first index to copy data into
count int The number of characters to read
리턴 int

Read7BitEncodedInt() 공개 메소드

Reads a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter.
public Read7BitEncodedInt ( ) : int
리턴 int

ReadBigEndian7BitEncodedInt() 공개 메소드

Reads a 7-bit encoded integer from the stream. This is stored with the most significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter.
public ReadBigEndian7BitEncodedInt ( ) : int
리턴 int

ReadBoolean() 공개 메소드

Reads a boolean from the stream. 1 byte is read.
public ReadBoolean ( ) : bool
리턴 bool

ReadByte() 공개 메소드

Reads a single byte from the stream.
public ReadByte ( ) : byte
리턴 byte

ReadBytes() 공개 메소드

Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will return what is available.
public ReadBytes ( int count ) : byte[]
count int The number of bytes to read
리턴 byte[]

ReadBytesOrThrow() 공개 메소드

Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will throw an IOException.
public ReadBytesOrThrow ( int count ) : byte[]
count int The number of bytes to read
리턴 byte[]

ReadDecimal() 공개 메소드

Reads a decimal value from the stream, using the bit converter for this reader. 16 bytes are read.
public ReadDecimal ( ) : decimal
리턴 decimal

ReadDouble() 공개 메소드

Reads a double-precision floating-point value from the stream, using the bit converter for this reader. 8 bytes are read.
public ReadDouble ( ) : double
리턴 double

ReadInt16() 공개 메소드

Reads a 16-bit signed integer from the stream, using the bit converter for this reader. 2 bytes are read.
public ReadInt16 ( ) : short
리턴 short

ReadInt32() 공개 메소드

Reads a 32-bit signed integer from the stream, using the bit converter for this reader. 4 bytes are read.
public ReadInt32 ( ) : int
리턴 int

ReadInt64() 공개 메소드

Reads a 64-bit signed integer from the stream, using the bit converter for this reader. 8 bytes are read.
public ReadInt64 ( ) : long
리턴 long

ReadSByte() 공개 메소드

Reads a single signed byte from the stream.
public ReadSByte ( ) : sbyte
리턴 sbyte

ReadSingle() 공개 메소드

Reads a single-precision floating-point value from the stream, using the bit converter for this reader. 4 bytes are read.
public ReadSingle ( ) : float
리턴 float

ReadString() 공개 메소드

Reads a length-prefixed string from the stream, using the encoding for this reader. A 7-bit encoded integer is first read, which specifies the number of bytes to read from the stream. These bytes are then converted into a string with the encoding for this reader.
public ReadString ( int bytesToRead ) : string
bytesToRead int
리턴 string

ReadUInt16() 공개 메소드

Reads a 16-bit unsigned integer from the stream, using the bit converter for this reader. 2 bytes are read.
public ReadUInt16 ( ) : ushort
리턴 ushort

ReadUInt32() 공개 메소드

Reads a 32-bit unsigned integer from the stream, using the bit converter for this reader. 4 bytes are read.
public ReadUInt32 ( ) : uint
리턴 uint

ReadUInt64() 공개 메소드

Reads a 64-bit unsigned integer from the stream, using the bit converter for this reader. 8 bytes are read.
public ReadUInt64 ( ) : ulong
리턴 ulong

Seek() 공개 메소드

Seeks within the stream.
public Seek ( int offset, SeekOrigin origin ) : void
offset int Offset to seek to.
origin SeekOrigin Origin of seek operation.
리턴 void