Class FlexibleBinaryWriter
- Namespace
- PushTechnology.ClientInterface.IO
- Assembly
- Diffusion.Client.dll
The binary writer that is able to write basic data types to a stream.
public sealed class FlexibleBinaryWriter
- Inheritance
-
FlexibleBinaryWriter
- Inherited Members
Constructors
FlexibleBinaryWriter(Stream, ByteOrder)
Creates a new FlexibleBinaryWriter that will be able to write basic data types to the given stream.
public FlexibleBinaryWriter(Stream outputStream, ByteOrder byteOrder)
Parameters
outputStreamStreamThe stream to write to.
byteOrderByteOrderThe byte order to use for all writing operations.
Remarks
The reader does not take ownership of the given outputStream.
The stream needs to be disposed of if it is no longer needed.
Exceptions
- ArgumentNullException
The given stream is
null.- ArgumentException
The given stream does not support writing.
Properties
BaseStream
Returns the underlying stream.
public Stream BaseStream { get; }
Property Value
- Stream
The underlying stream.
ByteOrder
Returns the byte order the writer operates in.
public ByteOrder ByteOrder { get; }
Property Value
- ByteOrder
The byte order the writer operates in.
Methods
Flush()
Causes any buffered data to be written to the stream.
public void Flush()
Write(byte)
Writes a single byte to the stream.
public void Write(byte value)
Parameters
valuebyteThe byte value to write to the stream.
Write(byte[])
Writes a sequence of bytes to the stream.
public void Write(byte[] value)
Parameters
valuebyte[]The sequence of bytes to write to the stream.
Exceptions
- ArgumentNullException
The given sequence of bytes is
null.
Write(byte[], int, int)
Writes a segment of a byte sequence to the stream.
public void Write(byte[] value, int offset, int length)
Parameters
valuebyte[]The segment of bytes to write to the stream.
offsetintThe starting index of the array segment.
lengthintThe length of the array segment.
Exceptions
- ArgumentNullException
The given array is
null.- ArgumentOutOfRangeException
The given offset or length are negative or bigger than the given array.
Write(char)
Writes a 16-bit character to the stream.
public void Write(char value)
Parameters
valuecharThe 16-bit character to write to the stream.
Write(double)
Writes a 64-bit floating point to the stream.
public void Write(double value)
Parameters
valuedoubleThe 64-bit floating point to write to the stream.
Write(short)
Writes a 16-bit signed integer to the stream.
public void Write(short value)
Parameters
valueshortThe 16-bit signed integer to write to the stream.
Write(int)
Writes a 32-bit signed integer to the stream.
public void Write(int value)
Parameters
valueintThe 32-bit signed integer to write to the stream.
Write(long)
Writes a 64-bit signed integer to the stream.
public void Write(long value)
Parameters
valuelongThe 64-bit signed integer to write to the stream.
Write(sbyte)
Writes a signed byte to the stream.
public void Write(sbyte value)
Parameters
valuesbyteThe signed byte value to write to the stream.
Write(float)
Writes a 32-bit floating point to the stream.
public void Write(float value)
Parameters
valuefloatThe 32-bit floating point to write to the stream.
Write(ushort)
Writes a 16-bit unsigned integer to the stream.
public void Write(ushort value)
Parameters
valueushortThe 16-bit unsigned integer to write to the stream.
Write(uint)
Writes a 32-bit unsigned integer to the stream.
public void Write(uint value)
Parameters
valueuintThe 32-bit unsigned integer to write to the stream.
Write(ulong)
Writes a 64-bit unsigned integer to the stream.
public void Write(ulong value)
Parameters
valueulongThe 64-bit unsigned integer to write to the stream.