PacketReader Class |
Namespace: Demo3D.IO
public abstract class PacketReader : PacketIO, IPacketReader, IPacketIO, IDataIO, IDataLocationProvider, IBufferReader, IDataReader, IOffsetDataReader, IDataReferenceReader, 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 (or null).
Only returns a stream if the underlying data source is a 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.
Returning false does not necessarily mean that data is not available. It may be that it's not possible to detect data.
| |
| Endian |
Endianess for integral types.
(Inherited from PacketIO.) | |
| ID |
Optional ID to identify the packet (eg source/destination, packet section, etc).
(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.) | |
| 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.
| |
| Consume |
Returns a new packet pointing to the next length bytes, and advances the current packet position.
Implies Ensure(length).
| |
| Create(ArraySegmentByte, Endian, BinaryTextEncoding, String) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(Byte, Endian, BinaryTextEncoding, String) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(PacketReaderPacketIOMethods, Endian, BinaryTextEncoding, String) |
Creates a PacketReader.
| |
| Create(Stream, Endian, BinaryTextEncoding, String) |
Creates a PacketReader from a stream of data.
The underlying stream is left open when the PacketReader is closed.
| |
| Create(Stream, PacketKey, Endian, BinaryTextEncoding, String) |
Creates a PacketReader from a stream of data.
The underlying stream is left open when the PacketReader is closed.
| |
| Create(ArraySegmentByte, Int32, Int32, Endian, BinaryTextEncoding, String) |
Creates a fixed size PacketReader from a buffer of data.
| |
| Create(Byte, Int32, Int32, Endian, BinaryTextEncoding, String) |
Creates a fixed size PacketReader from a buffer of data.
| |
| 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.) | |
| 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.
| |
| 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).
| |
| Prune |
Declare that we'll not want to read length bytes again, allowing the packet to free memory.
Advances ValidFrom by length bytes.
|
| 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.
|
| Name | Description | |
|---|---|---|
| Consume |
Returns a new data reader pointing to the next length bytes, and advances the current packet position.
Implies EnsureAsync(length).
(Defined by DataReaderExtensions.) | |
| GetString | Overloaded.
Reads a string from the current position in the packet packet.
The current position is advanced by the number of bytes read.
(Defined by PacketReaderExtensions.) | |
| GetString(BinaryTextEncoding) | Overloaded.
Reads a string from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| Peek |
Returns a new packet pointing to the next length bytes, but does not advance the current packet position.
Implies EnsureAsync(length).
(Defined by DataReaderExtensions.) | |
| ReadBit(Int32) | Overloaded.
Reads a bit from the current position in the buffer.
The current position is advanced by 1 byte.
(Defined by DataReaderExtensions.) | |
| ReadBit(Int32, Int32) | Overloaded.
Reads a bit at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadBoolean | Overloaded.
Reads a boolean from the current position in the buffer.
The current position is advanced by 1 byte.
(Defined by DataReaderExtensions.) | |
| ReadBoolean(Int32) | Overloaded.
Reads a boolean at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadByte | Overloaded.
Reads a byte from the current position in the buffer.
The current position is advanced by 1 byte.
(Defined by DataReaderExtensions.) | |
| ReadByte(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadBytes(ArraySegmentByte) | Overloaded.
Reads a number of bytes from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadBytes(Int32) | Overloaded.
Reads a number of bytes from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadBytes(IDataWriter, Int32) | Overloaded.
Reads a number of bytes from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadBytes(Int32, Int32) | Overloaded.
Reads a number of bytes at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadBytes(Int32, ArraySegmentByte) | Overloaded.
Reads a number of bytes at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadBytes(ArraySegmentByte, Int32, Int32) | Overloaded.
Reads a number of bytes from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadBytes(Byte, Int32, Int32) | Overloaded.
Reads a number of bytes from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadBytes(Int32, IDataWriter, Int32) | Overloaded.
Reads a number of bytes at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadBytes(Int32, Byte, Int32, Int32) | Overloaded.
Reads a number of bytes at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadChar | Overloaded.
Reads a character from the current position in the buffer.
The current position is advanced by 1 byte.
(Defined by DataReaderExtensions.) | |
| ReadChar(Int32) | Overloaded.
Reads a character at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadDouble | Overloaded.
Reads a 64bit double floating point number from the current position in the packet packet.
The current position is advanced by 8 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadDouble(Endian) | Overloaded.
Reads a 64bit double floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadDouble(Int32, Endian) | Overloaded.
Reads a 64bit double floating point number at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadDoubleBE | Overloaded.
Reads a 64bit double floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadDoubleBE(Int32) | Overloaded.
Reads a 64bit double floating point number at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadDoubleLE | Overloaded.
Reads a 64bit double floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadDoubleLE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadInt16 | Overloaded.
Reads a 16bit signed integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadInt16(Endian) | Overloaded.
Reads a 16bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt16(Int32, Endian) | Overloaded.
Reads a 16bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt16BE | Overloaded.
Reads a 16bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt16BE(Int32) | Overloaded.
Reads a 16bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt16LE | Overloaded.
Reads a 16bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt16LE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadInt32 | Overloaded.
Reads a 32bit signed integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadInt32(Endian) | Overloaded.
Reads a 32bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt32(Int32, Endian) | Overloaded.
Reads a 32bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt32BE | Overloaded.
Reads a 32bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt32BE(Int32) | Overloaded.
Reads a 32bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt32LE | Overloaded.
Reads a 32bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt32LE(Int32) | Overloaded.
Reads the memory exchange from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadInt64 | Overloaded.
Reads a 64bit signed integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadInt64(Endian) | Overloaded.
Reads a 64bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt64(Int32, Endian) | Overloaded.
Reads a 64bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt64BE | Overloaded.
Reads a 64bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt64BE(Int32) | Overloaded.
Reads a 64bit signed integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadInt64LE | Overloaded.
Reads a 64bit signed integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadInt64LE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadSByte | Overloaded.
Reads a signed byte from the current position in the buffer.
The current position is advanced by 1 byte.
(Defined by DataReaderExtensions.) | |
| ReadSByte(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadSingle | Overloaded.
Reads a 32bit single floating point number from the current position in the packet packet.
The current position is advanced by 4 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadSingle(Endian) | Overloaded.
Reads a 32bit single floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadSingle(Int32, Endian) | Overloaded.
Reads a 32bit single floating point number at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadSingleBE | Overloaded.
Reads a 32bit single floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadSingleBE(Int32) | Overloaded.
Reads a 32bit single floating point number at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadSingleLE | Overloaded.
Reads a 32bit single floating point number at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadSingleLE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadString | Overloaded.
Reads a string from the current position in the packet packet.
The current position is advanced by the number of bytes read.
(Defined by PacketReaderExtensions.) | |
| ReadString(BinaryTextEncoding) | Overloaded.
Reads a string from the current position in the buffer.
The current position is advanced by the number of bytes read.
(Defined by DataReaderExtensions.) | |
| ReadString(Int32, BinaryTextEncoding) | Overloaded.
Reads a string at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt16 | Overloaded.
Reads a 16bit unsigned integer from the current position in the packet packet.
The current position is advanced by 2 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadUInt16(Endian) | Overloaded.
Reads a 16bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt16(Int32, Endian) | Overloaded.
Reads a 16bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt16BE | Overloaded.
Reads a 16bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt16BE(Int32) | Overloaded.
Reads a 16bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt16LE | Overloaded.
Reads a 16bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt16LE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadUInt32 | Overloaded.
Reads a 32bit unsigned integer from the current position in the packet packet.
The current position is advanced by 4 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadUInt32(Endian) | Overloaded.
Reads a 32bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt32(Int32, Endian) | Overloaded.
Reads a 32bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt32BE | Overloaded.
Reads a 32bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt32BE(Int32) | Overloaded.
Reads a 32bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt32LE | Overloaded.
Reads a 32bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt32LE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) | |
| ReadUInt64 | Overloaded.
Reads a 64bit unsigned integer from the current position in the packet packet.
The current position is advanced by 8 bytes.
(Defined by PacketReaderExtensions.) | |
| ReadUInt64(Endian) | Overloaded.
Reads a 64bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt64(Int32, Endian) | Overloaded.
Reads a 64bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt64BE | Overloaded.
Reads a 64bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt64BE(Int32) | Overloaded.
Reads a 64bit unsigned integer at offset in the buffer.
(Defined by OffsetDataReaderExtensions.) | |
| ReadUInt64LE | Overloaded.
Reads a 64bit unsigned integer at the current position in the buffer.
(Defined by DataReaderExtensions.) | |
| ReadUInt64LE(Int32) | Overloaded.
Reads from the specified offset and returns the data as a value.
(Defined by DataReferenceExtensions.) |