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
stream
StreamThe 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
align
uintThe 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
align
uintThe boundary to use.
startOffset
ulongThe 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
value
intThe value to write.
WriteAsciiString(string)
Writes an ASCII string to the stream.
public void WriteAsciiString(string value)
Parameters
value
stringThe 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
value
stringThe 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
value
byteThe byte to write.
WriteBytes(byte[])
Writes a buffer of data to the stream.
public void WriteBytes(byte[] buffer)
Parameters
buffer
byte[]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
buffer
byte[]The buffer to write to the stream.
startIndex
intThe index to start reading from the buffer.
count
intThe 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
buffer
ReadOnlySpan<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
value
intThe value to write.
WriteCompressedUInt32(uint)
Compresses and writes an unsigned integer to the stream.
public void WriteCompressedUInt32(uint value)
Parameters
value
uintThe value to write.
WriteDecimal(decimal)
Writes a 128-bit decimal value to the stream.
public void WriteDecimal(decimal value)
Parameters
value
decimalThe 128-bit decimal value to write.
WriteDouble(double)
Writes a 64-bit floating point number to the stream.
public void WriteDouble(double value)
Parameters
value
doubleThe 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
value
shortThe signed 16-bit integer to write.
WriteInt32(int)
Writes a signed 32-bit integer to the stream.
public void WriteInt32(int value)
Parameters
value
intThe signed 32-bit integer to write.
WriteInt64(long)
Writes a signed 64-bit integer to the stream.
public void WriteInt64(long value)
Parameters
value
longThe 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
value
ulongThe value to write.
is32Bit
boolIndicates 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
value
sbyteThe signed byte to write.
WriteSerString(Utf8String?)
Writes an UTF8 string to the stream.
public void WriteSerString(Utf8String? value)
Parameters
value
Utf8StringThe string to write.
WriteSerString(string?)
Writes an UTF8 string to the stream.
public void WriteSerString(string? value)
Parameters
value
stringThe string to write.
WriteSingle(float)
Writes a 32-bit floating point number to the stream.
public void WriteSingle(float value)
Parameters
value
floatThe 32-bit floating point number to write.
WriteUInt16(ushort)
Writes an unsigned 16-bit integer to the stream.
public void WriteUInt16(ushort value)
Parameters
value
ushortThe unsigned 16-bit integer to write.
WriteUInt32(uint)
Writes an unsigned 32-bit integer to the stream.
public void WriteUInt32(uint value)
Parameters
value
uintThe unsigned 32-bit integer to write.
WriteUInt64(ulong)
Writes an unsigned 64-bit integer to the stream.
public void WriteUInt64(ulong value)
Parameters
value
ulongThe unsigned 64-bit integer to write.
WriteZeroes(int)
Writes a specified number of zero bytes to the stream.
public void WriteZeroes(int count)
Parameters
count
intThe number of zeroes to write.