Table of Contents

Class StreamExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extensions for the Stream class.

public static class StreamExtensions
Inheritance
StreamExtensions
Inherited Members

Methods

ReachedEnd(Stream)

Determines whether a Stream has reached its end.

public static bool ReachedEnd(this Stream stream)

Parameters

stream Stream

The Stream whose position to check.

Returns

bool

true if Position >= Length, otherwise false.

ReadASCIIString(Stream, long)

Reads a string encoded in ASCII from the stream at the current position.

public static string ReadASCIIString(this Stream stream, long byteLength)

Parameters

stream Stream

The stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadASCIIStringAt(Stream, long, long)

Reads a string encoded in ASCII from the stream at the specified position.

public static string ReadASCIIStringAt(this Stream stream, long position, long byteLength)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadInt16(Stream)

Reads a short from the stream at the current position.

public static short ReadInt16(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

short

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadInt16At(Stream, long)

Reads a short from the stream at the specified position.

public static short ReadInt16At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

short

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadInt32(Stream)

Reads an int from the stream at the current position.

public static int ReadInt32(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

int

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadInt32At(Stream, long)

Reads an int from the stream at the specified position.

public static int ReadInt32At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

int

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadInt64(Stream)

Reads a long from the stream at the current position.

public static long ReadInt64(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

long

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadInt64At(Stream, long)

Reads a long from the stream at the specified position.

public static long ReadInt64At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

long

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadSByte(Stream)

Reads a sbyte from the stream at the current position.

public static sbyte ReadSByte(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

sbyte

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadSByteAt(Stream, long)

Reads a sbyte from the stream at the specified position.

public static sbyte ReadSByteAt(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

sbyte

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadString(Stream, long, Encoding)

Reads a string encoded in a specified encoding from the stream at the current position.

public static string ReadString(this Stream stream, long byteLength, Encoding encoding)

Parameters

stream Stream

The stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

encoding Encoding

The encoding of the string.

Returns

string

The read string from the stream in the provided encoding.

ReadStringAt(Stream, long, long, Encoding)

Reads a string encoded in a specified encoding from the stream at the specified position.

public static string ReadStringAt(this Stream stream, long position, long byteLength, Encoding encoding)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

encoding Encoding

The encoding of the string.

Returns

string

The read string from the stream in the provided encoding.

ReadUInt16(Stream)

Reads a ushort from the stream at the current position.

public static ushort ReadUInt16(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

ushort

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUInt16At(Stream, long)

Reads a ushort from the stream at the specified position.

public static ushort ReadUInt16At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

ushort

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUInt32(Stream)

Reads a uint from the stream at the current position.

public static uint ReadUInt32(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

uint

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUInt32At(Stream, long)

Reads a uint from the stream at the specified position.

public static uint ReadUInt32At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

uint

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUInt64(Stream)

Reads a ulong from the stream at the current position.

public static ulong ReadUInt64(this Stream stream)

Parameters

stream Stream

The stream to read from.

Returns

ulong

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUInt64At(Stream, long)

Reads a ulong from the stream at the specified position.

public static ulong ReadUInt64At(this Stream stream, long position)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

ulong

The read value from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadUTF32String(Stream, long)

Reads a string encoded in UTF-32 from the stream at the current position.

public static string ReadUTF32String(this Stream stream, long byteLength)

Parameters

stream Stream

The stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadUTF32StringAt(Stream, long, long)

Reads a string encoded in UTF-32 from the stream at the specified position.

public static string ReadUTF32StringAt(this Stream stream, long position, long byteLength)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadUTF8String(Stream, long)

Reads a string encoded in UTF-8 from the stream at the current position.

public static string ReadUTF8String(this Stream stream, long byteLength)

Parameters

stream Stream

The stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadUTF8StringAt(Stream, long, long)

Reads a string encoded in UTF-8 from the stream at the specified position.

public static string ReadUTF8StringAt(this Stream stream, long position, long byteLength)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadUnicodeString(Stream, long)

Reads a string encoded in Unicode (UTF-16) from the stream at the current position.

public static string ReadUnicodeString(this Stream stream, long byteLength)

Parameters

stream Stream

The stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadUnicodeStringAt(Stream, long, long)

Reads a string encoded in Unicode (UTF-16) from the stream at the specified position.

public static string ReadUnicodeStringAt(this Stream stream, long position, long byteLength)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

byteLength long

The number of bytes to read. This does not necessarily equal the number of characters the resulting string contains.

Returns

string

The read string from the stream in the provided encoding.

ReadValueAt<T>(Stream, long)

Reads a value from the stream at the specified position.

public static T ReadValueAt<T>(this Stream stream, long position) where T : unmanaged

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

Returns

T

The read value from the stream.

Type Parameters

T

The type of the value to read from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

ReadValue<T>(Stream)

Reads a value from the stream at the current position.

public static T ReadValue<T>(this Stream stream) where T : unmanaged

Parameters

stream Stream

The stream to read from.

Returns

T

The read value from the stream.

Type Parameters

T

The type of the value to read from the stream.

Exceptions

EndOfStreamException

Thrown when the stream would not provide enough bytes to read.

RemainingBytes(Stream)

Calculates the remaining number of bytes that can be read from the Stream before reaching its end.

public static long RemainingBytes(this Stream stream)

Parameters

stream Stream

The Stream whose remaining byte count to calculate.

Returns

long

The number of bytes that can be read from the Stream before its end is reached.

ResetPosition(Stream)

Resets a stream's position to 0.

public static void ResetPosition(this Stream stream)

Parameters

stream Stream

The Stream whose position to set to 0.

ToByteArray(Stream)

Reads all the contents of the stream and stores them to a newly initialized byte array.

public static byte[] ToByteArray(this Stream stream)

Parameters

stream Stream

The stream whose contents will be read and written into the target array.

Returns

byte[]

The newly created byte array containing the read contents of the Stream.

Remarks

Be careful when using this method on very large streams, all the contents will be copied over to the memory, which is far more limited than storage.

TryReadByte(Stream, out byte)

Reads a byte from the stream at the current position.

public static bool TryReadByte(this Stream stream, out byte value)

Parameters

stream Stream

The stream to read from.

value byte

The value. Its value is always equal to the first byte of the int that ReadByte() returns. Only use the value if the method returns true.

Returns

bool

true if the byte was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadByteAt(Stream, long, out byte)

Reads a byte from the stream at the specified position.

public static bool TryReadByteAt(this Stream stream, long position, out byte value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value byte

The value. Its value is always equal to the first byte of the int that ReadByte() returns. Only use the value if the method returns true.

Returns

bool

true if the byte was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadInt16At(Stream, long, out short)

Reads a short from the stream at the specified position.

public static bool TryReadInt16At(this Stream stream, long position, out short value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value short

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the short was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadInt16<T>(Stream, out short)

Reads a short from the stream at the current position.

public static bool TryReadInt16<T>(this Stream stream, out short value)

Parameters

stream Stream

The stream to read from.

value short

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the short was successfully read from the stream, otherwise false, if the stream has reached its end.

Type Parameters

T

TryReadInt32(Stream, out int)

Reads an int from the stream at the current position.

public static bool TryReadInt32(this Stream stream, out int value)

Parameters

stream Stream

The stream to read from.

value int

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the int was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadInt32At(Stream, long, out int)

Reads an int from the stream at the specified position.

public static bool TryReadInt32At(this Stream stream, long position, out int value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value int

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the int was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadInt64(Stream, out long)

Reads a long from the stream at the current position.

public static bool TryReadInt64(this Stream stream, out long value)

Parameters

stream Stream

The stream to read from.

value long

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the long was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadInt64At(Stream, long, out long)

Reads a long from the stream at the specified position.

public static bool TryReadInt64At(this Stream stream, long position, out long value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value long

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the long was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadSByte(Stream, out sbyte)

Reads a sbyte from the stream at the current position.

public static bool TryReadSByte(this Stream stream, out sbyte value)

Parameters

stream Stream

The stream to read from.

value sbyte

The value. Its value is always equal to the first byte of the int that ReadByte() returns. Only use the value if the method returns true.

Returns

bool

true if the sbyte was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadSByteAt(Stream, long, out sbyte)

Reads a sbyte from the stream at the specified position.

public static bool TryReadSByteAt(this Stream stream, long position, out sbyte value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value sbyte

The value. Its value is always equal to the first byte of the int that ReadByte() returns. Only use the value if the method returns true.

Returns

bool

true if the sbyte was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt16(Stream, out ushort)

Reads a ushort from the stream at the current position.

public static bool TryReadUInt16(this Stream stream, out ushort value)

Parameters

stream Stream

The stream to read from.

value ushort

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ushort was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt16At(Stream, long, out ushort)

Reads a ushort from the stream at the specified position.

public static bool TryReadUInt16At(this Stream stream, long position, out ushort value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value ushort

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ushort was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt32(Stream, out uint)

Reads a uint from the stream at the current position.

public static bool TryReadUInt32(this Stream stream, out uint value)

Parameters

stream Stream

The stream to read from.

value uint

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the uint was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt32At(Stream, long, out uint)

Reads a uint from the stream at the specified position.

public static bool TryReadUInt32At(this Stream stream, long position, out uint value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value uint

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the uint was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt64(Stream, out ulong)

Reads a ulong from the stream at the current position.

public static bool TryReadUInt64(this Stream stream, out ulong value)

Parameters

stream Stream

The stream to read from.

value ulong

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ulong was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadUInt64At(Stream, long, out ulong)

Reads a ulong from the stream at the specified position.

public static bool TryReadUInt64At(this Stream stream, long position, out ulong value)

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value ulong

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ulong was successfully read from the stream, otherwise false, if the stream has reached its end.

TryReadValueAt<T>(Stream, long, out T)

Reads a T from the stream at the specified position.

public static bool TryReadValueAt<T>(this Stream stream, long position, out T value) where T : unmanaged

Parameters

stream Stream

The stream to read from.

position long

The position in the stream to read from.

value T

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ushort was successfully read from the stream, otherwise false, if the stream has reached its end.

Type Parameters

T

The type of the value to read.

TryReadValue<T>(Stream, out T)

Reads a T from the stream at the current position.

public static bool TryReadValue<T>(this Stream stream, out T value) where T : unmanaged

Parameters

stream Stream

The stream to read from.

value T

The value. Its value is always equal to the buffer after calling the Read(Span<byte>) function on it. Only use the value if the method returns true.

Returns

bool

true if the ushort was successfully read from the stream, otherwise false, if the stream has reached its end.

Type Parameters

T

The type of the value to read.

Write(Stream, byte)

Writes a byte to the stream at the current position.

public static void Write(this Stream stream, byte value)

Parameters

stream Stream

The stream to write to.

value byte

The value to write to the stream.

Write(Stream, byte[])

Writes all contents of a byte buffer to the stream at the current position.

public static void Write(this Stream stream, byte[] buffer)

Parameters

stream Stream

The stream to write to.

buffer byte[]

The buffer to write to the stream.

Write(Stream, short)

Writes a short to the stream at the current position.

public static void Write(this Stream stream, short value)

Parameters

stream Stream

The stream to write to.

value short

The value to write to the stream.

Write(Stream, int)

Writes a int to the stream at the current position.

public static void Write(this Stream stream, int value)

Parameters

stream Stream

The stream to write to.

value int

The value to write to the stream.

Write(Stream, long)

Writes a long to the stream at the current position.

public static void Write(this Stream stream, long value)

Parameters

stream Stream

The stream to write to.

value long

The value to write to the stream.

Write(Stream, long, byte[])

Writes all contents of a byte buffer to the stream at the current position.

public static void Write(this Stream stream, long position, byte[] buffer)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

buffer byte[]

The buffer to write to the stream.

Write(Stream, sbyte)

Writes a sbyte to the stream at the current position.

public static void Write(this Stream stream, sbyte value)

Parameters

stream Stream

The stream to write to.

value sbyte

The value to write to the stream.

Write(Stream, ushort)

Writes a ushort to the stream at the current position.

public static void Write(this Stream stream, ushort value)

Parameters

stream Stream

The stream to write to.

value ushort

The value to write to the stream.

Write(Stream, uint)

Writes a uint to the stream at the current position.

public static void Write(this Stream stream, uint value)

Parameters

stream Stream

The stream to write to.

value uint

The value to write to the stream.

Write(Stream, ulong)

Writes a ulong to the stream at the current position.

public static void Write(this Stream stream, ulong value)

Parameters

stream Stream

The stream to write to.

value ulong

The value to write to the stream.

WriteASCIIString(Stream, string)

Writes a string encoded in ASCII to the stream at the current position.

public static void WriteASCIIString(this Stream stream, string s)

Parameters

stream Stream

The stream to write to.

s string

The string to write to the stream.

WriteASCIIStringAt(Stream, long, string)

Writes a string encoded in ASCII to the stream at the specified position.

public static void WriteASCIIStringAt(this Stream stream, long position, string s)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

s string

The string to write to the stream.

WriteAt(Stream, long, byte)

Writes a byte to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, byte value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value byte

The value to write to the stream.

WriteAt(Stream, long, byte[])

Writes a byte[] to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, byte[] bytes)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

bytes byte[]

The bytes to write to the stream.

WriteAt(Stream, long, short)

Writes a short to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, short value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value short

The value to write to the stream.

WriteAt(Stream, long, int)

Writes an int to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, int value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value int

The value to write to the stream.

WriteAt(Stream, long, long)

Writes a long to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, long value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value long

The value to write to the stream.

WriteAt(Stream, long, sbyte)

Writes a sbyte to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, sbyte value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value sbyte

The value to write to the stream.

WriteAt(Stream, long, ushort)

Writes a ushort to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, ushort value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value ushort

The value to write to the stream.

WriteAt(Stream, long, uint)

Writes a uint to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, uint value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value uint

The value to write to the stream.

WriteAt(Stream, long, ulong)

Writes a ulong to the stream at the specified position.

public static void WriteAt(this Stream stream, long position, ulong value)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value ulong

The value to write to the stream.

WriteAt<T>(Stream, long, T)

Writes a value to the stream at the specified position.

public static void WriteAt<T>(this Stream stream, long position, T value) where T : unmanaged

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

value T

The value to write to the stream.

Type Parameters

T

The type of the value to write.

WriteString(Stream, string, Encoding)

Writes a string encoded in a specified encoding to the stream at the current position.

public static void WriteString(this Stream stream, string s, Encoding encoding)

Parameters

stream Stream

The stream to write to.

s string

The string to write to the stream.

encoding Encoding

The encoding of the string.

WriteStringAt(Stream, long, string, Encoding)

Writes a string encoded in a specified encoding to the stream at the specified position.

public static void WriteStringAt(this Stream stream, long position, string s, Encoding encoding)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

s string

The string to write to the stream.

encoding Encoding

The encoding of the string.

WriteUTF32String(Stream, string)

Writes a string encoded in UTF-32 to the stream at the current position.

public static void WriteUTF32String(this Stream stream, string s)

Parameters

stream Stream

The stream to write to.

s string

The string to write to the stream.

WriteUTF32StringAt(Stream, long, string)

Writes a string encoded in UTF-32 to the stream at the specified position.

public static void WriteUTF32StringAt(this Stream stream, long position, string s)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

s string

The string to write to the stream.

WriteUTF8String(Stream, string)

Writes a string encoded in UTF-8 to the stream at the current position.

public static void WriteUTF8String(this Stream stream, string s)

Parameters

stream Stream

The stream to write to.

s string

The string to write to the stream.

WriteUTF8StringAt(Stream, long, string)

Writes a string encoded in UTF-8 to the stream at the specified position.

public static void WriteUTF8StringAt(this Stream stream, long position, string s)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

s string

The string to write to the stream.

WriteUnicodeString(Stream, string)

Writes a string encoded in Unicode (UTF-16) to the stream at the current position.

public static void WriteUnicodeString(this Stream stream, string s)

Parameters

stream Stream

The stream to write to.

s string

The string to write to the stream.

WriteUnicodeStringAt(Stream, long, string)

Writes a string encoded in Unicode (UTF-16) to the stream at the specified position.

public static void WriteUnicodeStringAt(this Stream stream, long position, string s)

Parameters

stream Stream

The stream to write to.

position long

The position in the stream to write at.

s string

The string to write to the stream.

Write<T>(Stream, T)

Writes a value to the stream at the current position.

public static void Write<T>(this Stream stream, T value) where T : unmanaged

Parameters

stream Stream

The stream to write to.

value T

The value to write to the stream.

Type Parameters

T

The type of the value to write to the stream.