Class BinaryStreamWriter
- Namespace
- AsmResolver.IO
- Assembly
- AsmResolver.dll
Provides methods for writing data to an output stream.
public sealed class BinaryStreamWriter
- Inheritance
-
BinaryStreamWriter
- Inherited Members
Constructors
BinaryStreamWriter(Stream)
Creates a new binary stream writer using the provided output stream.
public BinaryStreamWriter(Stream stream)
Parameters
streamStreamThe stream to write to.
Properties
BaseStream
Gets the stream this writer writes to.
public Stream BaseStream { get; }
Property Value
Length
Gets or sets the current length of the stream.
public uint Length { get; }
Property Value
Offset
Gets or sets the current position of the
public ulong Offset { get; set; }
Property Value
Methods
Align(uint)
Aligns the writer to a specified boundary.
public void Align(uint align)
Parameters
alignuintThe boundary to use.
AlignRelative(uint, ulong)
Aligns the writer to a specified boundary, relative to the provided start offset..
public void AlignRelative(uint align, ulong startOffset)
Parameters
alignuintThe boundary to use.
startOffsetulongThe starting offset to consider the alignment boundaries from.
Write7BitEncodedInt32(int)
Writes a single 7-bit encoded 32-bit integer to the output stream.
public void Write7BitEncodedInt32(int value)
Parameters
valueintThe value to write.
WriteAsciiString(string)
Writes an ASCII string to the stream.
public void WriteAsciiString(string value)
Parameters
valuestringThe string to write.
WriteBinaryFormatterString(string)
Writes a serialized string using the UTF-8 encoding that is prefixed by a 7-bit encoded length header.
public void WriteBinaryFormatterString(string value)
Parameters
valuestringThe string to write.
WriteBinaryFormatterString(string, Encoding)
Writes a serialized string that is prefixed by a 7-bit encoded length header.
public void WriteBinaryFormatterString(string value, Encoding encoding)
Parameters
WriteByte(byte)
Writes a single byte to the stream.
public void WriteByte(byte value)
Parameters
valuebyteThe byte to write.
WriteBytes(byte[])
Writes a buffer of data to the stream.
public void WriteBytes(byte[] buffer)
Parameters
bufferbyte[]The data to write.
WriteBytes(byte[], int, int)
Writes a buffer of data to the stream.
public void WriteBytes(byte[] buffer, int startIndex, int count)
Parameters
bufferbyte[]The buffer to write to the stream.
startIndexintThe index to start reading from the buffer.
countintThe amount of bytes of the buffer to write.
WriteBytes(ReadOnlySpan<byte>)
Writes a buffer of data to the stream.
public void WriteBytes(ReadOnlySpan<byte> buffer)
Parameters
bufferReadOnlySpan<byte>The buffer to write to the stream.
WriteCompressedInt32(int)
Compresses and writes a signed integer to the stream.
public void WriteCompressedInt32(int value)
Parameters
valueintThe value to write.
WriteCompressedUInt32(uint)
Compresses and writes an unsigned integer to the stream.
public void WriteCompressedUInt32(uint value)
Parameters
valueuintThe value to write.
WriteDecimal(decimal)
Writes a 128-bit decimal value to the stream.
public void WriteDecimal(decimal value)
Parameters
valuedecimalThe 128-bit decimal value to write.
WriteDouble(double)
Writes a 64-bit floating point number to the stream.
public void WriteDouble(double value)
Parameters
valuedoubleThe 64-bit floating point number to write.
WriteIndex(uint, IndexSize)
Writes a single index to the output stream.
public void WriteIndex(uint value, IndexSize size)
Parameters
Exceptions
WriteInt16(short)
Writes a signed 16-bit integer to the stream.
public void WriteInt16(short value)
Parameters
valueshortThe signed 16-bit integer to write.
WriteInt32(int)
Writes a signed 32-bit integer to the stream.
public void WriteInt32(int value)
Parameters
valueintThe signed 32-bit integer to write.
WriteInt64(long)
Writes a signed 64-bit integer to the stream.
public void WriteInt64(long value)
Parameters
valuelongThe signed 64-bit integer to write.
WriteNativeInt(ulong, bool)
Writes either a 32-bit or a 64-bit number to the output stream.
public void WriteNativeInt(ulong value, bool is32Bit)
Parameters
valueulongThe value to write.
is32BitboolIndicates the integer to be written is 32-bit or 64-bit.
WriteSByte(sbyte)
Writes an signed byte to the stream.
public void WriteSByte(sbyte value)
Parameters
valuesbyteThe signed byte to write.
WriteSerString(Utf8String?)
Writes an UTF8 string to the stream.
public void WriteSerString(Utf8String? value)
Parameters
valueUtf8StringThe string to write.
WriteSerString(string?)
Writes an UTF8 string to the stream.
public void WriteSerString(string? value)
Parameters
valuestringThe string to write.
WriteSingle(float)
Writes a 32-bit floating point number to the stream.
public void WriteSingle(float value)
Parameters
valuefloatThe 32-bit floating point number to write.
WriteUInt16(ushort)
Writes an unsigned 16-bit integer to the stream.
public void WriteUInt16(ushort value)
Parameters
valueushortThe unsigned 16-bit integer to write.
WriteUInt32(uint)
Writes an unsigned 32-bit integer to the stream.
public void WriteUInt32(uint value)
Parameters
valueuintThe unsigned 32-bit integer to write.
WriteUInt64(ulong)
Writes an unsigned 64-bit integer to the stream.
public void WriteUInt64(ulong value)
Parameters
valueulongThe unsigned 64-bit integer to write.
WriteZeroes(int)
Writes a specified number of zero bytes to the stream.
public void WriteZeroes(int count)
Parameters
countintThe number of zeroes to write.