PacketReader Class |
Namespace: Demo3D.IO
public abstract class PacketReader : PacketIO, IDataReader, IDisposable
The PacketReader type exposes the following members.
| Name | Description | |
|---|---|---|
| PacketReader |
Creates a new packet reader.
|
| Name | Description | |
|---|---|---|
| BaseStream |
Exposes access to the underlying stream.
| |
| DataAvailable |
Returns true if data is immediately available. (Specifically that EnsureAsync(1) won't block.)
Returns true if there's any data remaining in the packet (this.Remaining > 0), or if the underlying stream has data available.
| |
| DataLengthOfParent |
Returns the length in bytes from this position to the current parent packet Position.
For a PacketReader this is the length from this PacketPosition to our parents current Position.
For a PacketWriter it's the length from this PacketPosition to the end of our Parent packet.
(Inherited from PacketPosition.) | |
| Endian |
Endianess for integral types.
(Inherited from PacketIO.) | |
| ID |
Optional ID used in error messages.
(Inherited from PacketIO.) | |
| IsFixed |
Returns true if this is a fixed size packet. Ensure can't expand a fixed packet.
(Inherited from PacketIO.) | |
| Length |
Returns the current length of the packet.
(Overrides PacketIOLength.) | |
| LengthToCurrentPositionOfParent |
Returns the length in bytes from this position to the current position of our parent packet.
(Inherited from PacketPosition.) | |
| LengthToEndOfParent |
Returns the length in bytes from this position to the end of our parent packet.
(Inherited from PacketIO.) | |
| Parent |
Returns the parent packet, or null.
(Inherited from PacketPosition.) | |
| Position |
Returns the current position in the packet.
(Overrides PacketIOPosition.) | |
| PositionInParent |
Returns the current position with respect to our parent packet.
(Inherited from PacketIO.) | |
| Remaining |
Returns the remaining data/space available in the packet. If it's a fixed-size packet, then this is definitive.
Otherwise Ensure can be used to try to extend the packet with more data/space.
(Overrides PacketIORemaining.) | |
| TextEncoding |
Encoding for text strings.
(Inherited from PacketIO.) | |
| Top |
Returns the top parent.
(Inherited from PacketIO.) | |
| ValidFrom |
Returns the low water mark of the packet. Data prior to this mark may have been discarded and cannot be read.
|
| Name | Description | |
|---|---|---|
| Advance |
Advances the current packet position. Implies Ensure(length).
(Inherited from PacketIO.) | |
| Close |
Closes the current reader and closes access to the underlying stream.
| |
| ClosePacket |
Close access to any associated data stream.
| |
| Consume |
Returns a new packet pointing to the next length bytes, and advances the current packet position.
Implies Ensure(length).
| |
| Create(Byte, Endian, BinaryTextEncoding) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(Buffer, Endian, BinaryTextEncoding) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(Stream, Endian, BinaryTextEncoding, IEnumerableBuffer) |
Creates a PacketReader from a stream of data.
The underlying stream is left open when the PacketReader is closed.
| |
| Create(PacketReaderPacketIOMethods, Endian, BinaryTextEncoding, IEnumerableBuffer) |
Creates a PacketReader.
| |
| Create(Byte, Int32, Int32, Endian, BinaryTextEncoding) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(Stream, PacketKey, Endian, BinaryTextEncoding, IEnumerableBuffer) |
Creates a PacketReader from a stream of data.
The underlying stream is left open when the PacketReader is closed.
| |
| Create(Buffer, Int32, Int32, Endian, BinaryTextEncoding) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Dispose |
Closes the current reader and closes access to the underlying stream.
| |
| Ensure |
Ensure that the next length bytes of data/space are available in the packet. If there isn't enough already
available, and the packet isn't fixed, then it'll attempt to read more data into or create more space in the packet.
(Inherited from PacketIO.) | |
| EnsureAdditionalDataAsync |
Wait for at least length additional data to become available.
| |
| EnsureAsync |
Ensure that the next length bytes of data is available in the packet. If there isn't enough already
available, and the packet isn't fixed, then it'll attempt to read more data into the packet.
| |
| GetBuffer |
Get a buffer that covers a specific portion of the packet.
(Inherited from PacketIO.) | |
| GetEndian |
Returns the current endian format.
(Inherited from PacketIO.) | |
| GetTextEncoding |
Returns the current text encoding.
(Inherited from PacketIO.) | |
| LengthAfterChild |
Returns the length of the this packet after the end of a given direct child packet position.
(Overrides PacketIOLengthAfterChild(PacketIO).) | |
| MarkPosition |
Return a position marker.
(Overrides PacketIOMarkPosition.) | |
| Peek |
Returns a new packet pointing to the next length bytes, but does not advance the current packet position.
Implies Ensure(length).
| |
| PositionOfChild |
Returns the current absolute position of a direct child packet position.
(Overrides PacketIOPositionOfChild(PacketIO).) | |
| Prune |
Declare that we'll not want to read length bytes again, allowing the packet to free memory.
Advances ValidFrom by length bytes.
| |
| ReadBit(Int32) |
Reads a bit from the current position in the packet packet.
The current position is advanced by 1 byte.
| |
| ReadBit(Int32, Int32) |
Reads a bit at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadBoolean |
Reads a boolean from the current position in the packet packet.
The current position is advanced by 1 byte.
| |
| ReadBoolean(Int32) |
Reads a boolean at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadByte |
Reads a byte from the current position in the packet packet.
The current position is advanced by 1 byte.
| |
| ReadByte(Int32) |
Reads a byte at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadBytes(Int32) |
Reads a number of bytes from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadBytes(Buffer) |
Reads a number of bytes from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadBytes(Int32, Buffer) |
Reads a number of bytes at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadBytes(Int32, Int32) |
Reads a number of bytes at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadBytes(PacketWriter, Int32) |
Reads a number of bytes from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadBytes(Int32, PacketWriter, Int32) |
Reads a number of bytes at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadBytes(Byte, Int32, Int32) |
Reads a number of bytes from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadBytes(Int32, Byte, Int32, Int32) |
Reads a number of bytes at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadChar |
Reads a character from the current position in the packet packet.
The current position is advanced by 1 byte.
| |
| ReadChar(Int32) |
Reads a character at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadDouble(Endian) |
Reads a 64bit double floating point number from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadDouble(Int32, Endian) |
Reads a 64bit double floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadDoubleBE |
Reads a 64bit double floating point number from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadDoubleBE(Int32) |
Reads a 64bit double floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadDoubleLE |
Reads a 64bit double floating point number from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadDoubleLE(Int32) |
Reads a 64bit double floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt16(Endian) |
Reads a 16bit signed integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadInt16(Int32, Endian) |
Reads a 16bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt16BE |
Reads a 16bit signed integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadInt16BE(Int32) |
Reads a 16bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt16LE |
Reads a 16bit signed integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadInt16LE(Int32) |
Reads a 16bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt32(Endian) |
Reads a 32bit signed integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadInt32(Int32, Endian) |
Reads a 32bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt32BE |
Reads a 32bit signed integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadInt32BE(Int32) |
Reads a 32bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt32LE |
Reads a 32bit signed integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadInt32LE(Int32) |
Reads a 32bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt64(Endian) |
Reads a 64bit signed integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadInt64(Int32, Endian) |
Reads a 64bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt64BE |
Reads a 64bit signed integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadInt64BE(Int32) |
Reads a 64bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadInt64LE |
Reads a 64bit signed integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadInt64LE(Int32) |
Reads a 64bit signed integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadSByte |
Reads a signed byte from the current position in the packet packet.
The current position is advanced by 1 byte.
| |
| ReadSByte(Int32) |
Reads a signed byte at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadSingle(Endian) |
Reads a 32bit single floating point number from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadSingle(Int32, Endian) |
Reads a 32bit single floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadSingleBE |
Reads a 32bit single floating point number from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadSingleBE(Int32) |
Reads a 32bit single floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadSingleLE |
Reads a 32bit single floating point number from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadSingleLE(Int32) |
Reads a 32bit single floating point number at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadString |
Reads a string from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadString(Int32) |
Reads a string at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadString(BinaryTextEncoding) |
Reads a string from the current position in the packet packet.
The current position is advanced by the number of bytes read.
| |
| ReadString(Int32, BinaryTextEncoding) |
Reads a string at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt16(Endian) |
Reads a 16bit unsigned integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadUInt16(Int32, Endian) |
Reads a 16bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt16BE |
Reads a 16bit unsigned integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadUInt16BE(Int32) |
Reads a 16bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt16LE |
Reads a 16bit unsigned integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
| |
| ReadUInt16LE(Int32) |
Reads a 16bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt32(Endian) |
Reads a 32bit unsigned integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadUInt32(Int32, Endian) |
Reads a 32bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt32BE |
Reads a 32bit unsigned integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadUInt32BE(Int32) |
Reads a 32bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt32LE |
Reads a 32bit unsigned integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
| |
| ReadUInt32LE(Int32) |
Reads a 32bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt64(Endian) |
Reads a 64bit unsigned integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadUInt64(Int32, Endian) |
Reads a 64bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt64BE |
Reads a 64bit unsigned integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadUInt64BE(Int32) |
Reads a 64bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) | |
| ReadUInt64LE |
Reads a 64bit unsigned integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
| |
| ReadUInt64LE(Int32) |
Reads a 64bit unsigned integer at offset in the buffer.
(Inherited from PacketIO.) |
| Name | Description | |
|---|---|---|
| length |
The length of the packet.
| |
| position |
The current position in the packet.
| |
| remaining |
The number of bytes of data remaining in the packet.
|