Exemplo n.º 1
0
 public void WriteUInt32(uint num)
 {
     ByteUtil.WriteUInt32(num, this);
 }
Exemplo n.º 2
0
 public void WriteUInt64(ulong num)
 {
     ByteUtil.WriteUInt64(num, this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new non-resizable instance of the MemoryDataStream class by reading a specified number of bytes from the provided Stream.
 /// </summary>
 /// <param name="stream">The Stream to copy data from for initialization of the MemoryDataStream.</param>
 /// <param name="length">The number of bytes to read from the Stream.  This will be the size of the new MemoryDataStream.</param>
 public MemoryDataStream(Stream stream, int length) : base(ByteUtil.ReadNBytes(stream, length))
 {
 }
Exemplo n.º 4
0
 public void WriteUInt16(ushort num)
 {
     ByteUtil.WriteUInt16(num, this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Reads a specific number of bytes from the stream, returning a byte array.  Ordinary stream.Read operations are not guaranteed to read all the requested bytes.
 /// </summary>
 /// <param name="length">The number of bytes to read.</param>
 /// <returns></returns>
 public byte[] ReadNBytes(int length)
 {
     return(ByteUtil.ReadNBytes((Stream)this, length));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Reads a specific number of bytes from the stream, returning a byte array.  Ordinary stream.Read operations are not guaranteed to read all the requested bytes.
 /// </summary>
 /// <param name="length">The number of bytes to read.</param>
 /// <returns></returns>
 public byte[] ReadNBytesFromNetworkOrder(int length)
 {
     return(ByteUtil.ReadNBytesFromNetworkOrder((Stream)this, length));
 }
Exemplo n.º 7
0
 public string ReadUtf8(int lengthBytes)
 {
     return(ByteUtil.ReadUtf8(this, lengthBytes));
 }
Exemplo n.º 8
0
 /// <summary>
 /// <para>Writes the length of the string as a 32 bit unsigned integer, then writes the string.</para>
 /// <para>The string will be encoded as UTF8 with no byte order mark.</para>
 /// <para>Returns the number of bytes written.</para>
 /// </summary>
 /// <param name="str">String to write.</param>
 public uint WriteUtf8_32(string str)
 {
     return(ByteUtil.WriteUtf8_32(str, this));
 }
Exemplo n.º 9
0
 public float ReadFloat()
 {
     return(ByteUtil.ReadFloat(this));
 }
Exemplo n.º 10
0
 public double ReadDouble()
 {
     return(ByteUtil.ReadDouble(this));
 }
Exemplo n.º 11
0
 public ulong ReadUInt64()
 {
     return(ByteUtil.ReadUInt64(this));
 }
Exemplo n.º 12
0
 public uint ReadUInt32()
 {
     return(ByteUtil.ReadUInt32(this));
 }
Exemplo n.º 13
0
 public ushort ReadUInt16()
 {
     return(ByteUtil.ReadUInt16(this));
 }
Exemplo n.º 14
0
 public void WriteFloat(float num)
 {
     ByteUtil.WriteFloat(num, this);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Reads a UTF8 string (no byte order mark) from the stream, assuming the string's length is prepended as a 32 bit unsigned integer.
 /// </summary>
 /// <returns></returns>
 public string ReadUtf8_32()
 {
     return(ByteUtil.ReadUtf8_32(this));
 }
Exemplo n.º 16
0
 public void WriteDouble(double num)
 {
     ByteUtil.WriteDouble(num, this);
 }
Exemplo n.º 17
0
 /// <summary>
 /// <para>Writes the length of the string as a 16 bit unsigned integer, then writes the string.</para>
 /// <para>The string will be encoded as UTF8 with no byte order mark.</para>
 /// <para>Returns the number of bytes written.</para>
 /// <para>Throws an exception if the byte array is larger than a 16 bit unsigned integer can hold.</para>
 /// </summary>
 /// <param name="str">String to write.</param>
 /// <exception cref="ArgumentException">If the string is longer than 65535 characters or bytes.</exception>
 public ushort WriteUtf8_16(string str)
 {
     return(ByteUtil.WriteUtf8_16(str, this));
 }