Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Util.Streams.BinaryStream

Summary

Reads/writes various data types as binary values in a specific encoding.

Remarks

This class does not use any buffering of its own.

It is permissible to seek, read from, and write to the underlying stream.

Constructors

BinaryStream(Stream underlyingStream)
Constructs a BinaryStream instance.

Instance methods

void
  • Overrides: Stream.Flush()
Flushes the underlying stream. Note that BinaryStream does not use any buffering of its own that requires flushing.
int
Read(byte[] buffer, int offset, int count)
  • Overrides: Stream.Read(byte[], int, int)
Reads a sequence of bytes from the underlying stream and advances the position within the stream by the number of bytes read.
boolReads a boolean value from the stream.
byteReads a byte from the stream.
byte[]
ReadBytes(int count)
Reads the specified number of bytes from the stream.
charReads a character from the stream.
DateTimeReads a DateTime from the stream.
decimalReads a decimal number from the stream.
doubleReads a double-precision floating-point number from the stream.
floatReads a single-precision floating-point number from the stream.
intReads a 32-bit signed integer from the stream.
longReads a 64-bit signed integer from the stream.
MemoryStreamReads a length-prefixed block of bytes from the stream (for example, one produced by BinaryStream.WriteMemoryStream(MemoryStream)).
sbyteReads a signed byte from the stream.
shortReads a 16-bit signed integer from the stream.
stringReads a string from the stream.
TimeSpanReads a TimeSpan from the stream.
uintReads a 32-bit unsigned integer from the stream.
ulongReads a 64-bit unsigned integer from the stream.
ushortReads a 16-bit unsigned integer from the stream.
intReads a 32-bit signed integer using optim encoding (see StreamExtensions.ReadInt32Optim(this Stream)) from the stream.
longReads a 64-bit signed integer using optim encoding (see StreamExtensions.ReadInt64Optim(this Stream)) from the stream.
uintReads a 32-bit unsigned integer using optim encoding (see StreamExtensions.ReadUInt32Optim(this Stream)) from the stream.
ulongReads a 64-bit unsigned integer using optim encoding (see StreamExtensions.ReadUInt64Optim(this Stream)) from the stream.
long
Seek(long offset, SeekOrigin origin)
  • Overrides: Stream.Seek(long, SeekOrigin)
Sets the position within the underlying stream.
void
SetLength(long value)
  • Overrides: Stream.SetLength(long)
Sets the length of the underlying stream.
void
Write(byte[] buffer, int offset, int count)
  • Overrides: Stream.Write(byte[], int, int)
Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
void
WriteBool(bool value)
Writes a boolean value to the stream.
void
WriteByte(byte value)
  • Overrides: Stream.WriteByte(byte)
Writes a byte to the stream.
void
WriteBytes(byte[] data)
Writes the specified byte array into the stream.
void
WriteChar(char value)
Writes a character to the stream.
void
WriteDateTime(DateTime value)
Writes a DateTime to the stream.
void
WriteDecimal(decimal value)
Writes a decimal number to the stream.
void
WriteDouble(double value)
Writes a double-precision floating-point number to the stream.
void
WriteFloat(float value)
Writes a single-precision floating-point number to the stream.
void
WriteInt(int value)
Writes a 32-bit signed integer to the stream.
void
WriteLong(long value)
Writes a 64-bit signed integer to the stream.
void
WriteMemoryStream(MemoryStream stream)
Writes the data contained in the specified MemoryStream to the stream as a length-prefixed block of bytes.
void
WriteSByte(sbyte value)
Writes a signed byte to the stream.
void
WriteShort(short value)
Writes a 16-bit signed integer to the stream.
void
WriteString(string value)
Writes a string to the stream.
void
WriteTimeSpan(TimeSpan value)
Writes a TimeSpan to the stream.
void
WriteUInt(uint value)
Writes a 32-bit unsigned integer to the stream.
void
WriteULong(ulong value)
Writes a 64-bit unsigned integer to the stream.
void
WriteUShort(ushort value)
Writes a 16-bit unsigned integer to the stream.
void
WriteVarInt(int value)
Writes a 32-bit signed integer using optim encoding (see StreamExtensions.WriteInt32Optim(this Stream, int)) to the stream.
void
WriteVarLong(long value)
Writes a 64-bit signed integer using optim encoding (see StreamExtensions.WriteInt64Optim(this Stream, long)) to the stream.
void
WriteVarUInt(uint value)
Writes a 32-bit unsigned integer using optim encoding (see StreamExtensions.WriteUInt32Optim(this Stream, uint)) to the stream.
void
WriteVarULong(ulong value)
Writes a 64-bit unsigned integer using optim encoding (see StreamExtensions.WriteUInt64Optim(this Stream, ulong)) to the stream.

Instance properties

bool
  • Overrides: Stream.CanRead
Gets a value indicating whether the underlying stream supports reading.
bool
  • Overrides: Stream.CanSeek
Gets a value indicating whether the underlying stream supports seeking.
bool
  • Overrides: Stream.CanWrite
Gets a value indicating whether the underlying stream supports writing.
long
  • Overrides: Stream.Length
Gets the length in bytes of the underlying stream.
long
  • Overrides: Stream.Position
Gets or sets the position within the underlying stream.