StreamReader
A class in Alta.Serialization.Runtime, Alta.Serialization.
A Stream that reads bits from a uint buffer. Used on both sides to read network messages and saves; the same serialize calls that write with StreamWriter read with this.
- Listed in Other Alta assemblies
- Inherits or implements
Stream - Documented in Stream
Constructors
| Member | What it is |
|---|---|
StreamReader(Func<uint[], uint[]> getMoreData, int byteCount) | Creates a StreamReader with default values. |
StreamReader(uint[] data, int byteCount) | Creates a StreamReader with default values. |
1 private and internal constructor
| Member | What it is |
|---|---|
private StreamReader() | Creates a StreamReader with default values. |
Fields
2 private and internal fields
| Member | What it is |
|---|---|
private BitReader reader | The underlying bit reader. |
private static byte[] stringBuffer | Static shared buffer for string reads, doubled when a string is bigger. Not thread safe. |
Properties
Methods
| Member | What it is |
|---|---|
override void Align() | Skips to the next byte boundary. |
override void BackTrack(uint bitCount) | Moves the read position back by the given number of bits. |
override object Clone() | Returns a new reader over a copy of this reader's state. |
override void Dispose() | Clears the bit reader and drops it. The reader can't be used afterwards. |
void Initialize(uint[] data, int newSize) | Points the reader at a new buffer and byte count. |
void Reset() | Moves the read position back to the start. |
override void SerializeBits(ref uint value, int bitCount) | Reads the given number of bits into the value. |
override void SerializeString(ref string value, Stream.StringEncoding encoding = 0) | Reads a 16-bit length then that many aligned bytes, decoded as ASCII or UTF-8. |
byte[] ToBytes() | Copies the whole buffer out as a byte array. |
protected override void Finalize() | Destructor: calls Dispose if it hasn't run. |
protected override void SerializeBytes(byte[] value, int byteCount) | Reads raw bytes into the array. |
Used in
Members of other types that take, return or hold a StreamReader: