public class NetworkBinaryReader

Summary

Subclass of BinaryReader that reads integers etc in correct network order.

Remarks

Kludge to compensate for .NET's broken little-endian-only BinaryReader. Relies on BinaryReader always being little-endian.

Constructor Summary

Flags Name Summary
public NetworkBinaryReader(Stream input)

Construct a NetworkBinaryReader over the given input stream.

public NetworkBinaryReader(Stream input, Encoding encoding)

Construct a NetworkBinaryReader over the given input stream, reading strings using the given encoding.

Method Summary

Flags Name Summary
public virtual double ReadDouble()

Override BinaryReader's method for network-order.

public virtual short ReadInt16()

Override BinaryReader's method for network-order.

public virtual int ReadInt32()

Override BinaryReader's method for network-order.

public virtual long ReadInt64()

Override BinaryReader's method for network-order.

public virtual single ReadSingle()

Override BinaryReader's method for network-order.

public virtual ushort ReadUInt16()

Override BinaryReader's method for network-order.

public virtual uint ReadUInt32()

Override BinaryReader's method for network-order.

public virtual ulong ReadUInt64()

Override BinaryReader's method for network-order.

public static BinaryReader TemporaryBinaryReader(byte[] bytes)

Helper method for constructing a temporary BinaryReader over a byte[].

Constructor Detail

NetworkBinaryReader

public NetworkBinaryReader(Stream input)

Parameters
Name Type
input Stream

Summary

Construct a NetworkBinaryReader over the given input stream.

NetworkBinaryReader

public NetworkBinaryReader(Stream input, Encoding encoding)

Parameters
Name Type
input Stream
encoding Encoding

Summary

Construct a NetworkBinaryReader over the given input stream, reading strings using the given encoding.

Method Detail

ReadDouble

public virtual double ReadDouble()

Flags public virtual
Return type double

Summary

Override BinaryReader's method for network-order.

ReadInt16

public virtual short ReadInt16()

Flags public virtual
Return type short

Summary

Override BinaryReader's method for network-order.

ReadInt32

public virtual int ReadInt32()

Flags public virtual
Return type int

Summary

Override BinaryReader's method for network-order.

ReadInt64

public virtual long ReadInt64()

Flags public virtual
Return type long

Summary

Override BinaryReader's method for network-order.

ReadSingle

public virtual single ReadSingle()

Flags public virtual
Return type single

Summary

Override BinaryReader's method for network-order.

ReadUInt16

public virtual ushort ReadUInt16()

Flags public virtual
Return type ushort

Summary

Override BinaryReader's method for network-order.

ReadUInt32

public virtual uint ReadUInt32()

Flags public virtual
Return type uint

Summary

Override BinaryReader's method for network-order.

ReadUInt64

public virtual ulong ReadUInt64()

Flags public virtual
Return type ulong

Summary

Override BinaryReader's method for network-order.

TemporaryBinaryReader

public static BinaryReader TemporaryBinaryReader(byte[] bytes)

Flags public static
Return type BinaryReader
Parameters
Name Type
bytes byte[]

Summary

Helper method for constructing a temporary BinaryReader over a byte[].