예제 #1
0
 public void WriteUInt32(uint num)
 {
     ByteUtil.WriteUInt32(num, this);
 }
예제 #2
0
 public void WriteUInt64(ulong num)
 {
     ByteUtil.WriteUInt64(num, this);
 }
예제 #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))
 {
 }
예제 #4
0
 public void WriteUInt16(ushort num)
 {
     ByteUtil.WriteUInt16(num, this);
 }
예제 #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));
 }
예제 #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));
 }
예제 #7
0
 public string ReadUtf8(int lengthBytes)
 {
     return(ByteUtil.ReadUtf8(this, lengthBytes));
 }
예제 #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));
 }
예제 #9
0
 public float ReadFloat()
 {
     return(ByteUtil.ReadFloat(this));
 }
예제 #10
0
 public double ReadDouble()
 {
     return(ByteUtil.ReadDouble(this));
 }
예제 #11
0
 public ulong ReadUInt64()
 {
     return(ByteUtil.ReadUInt64(this));
 }
예제 #12
0
 public uint ReadUInt32()
 {
     return(ByteUtil.ReadUInt32(this));
 }
예제 #13
0
 public ushort ReadUInt16()
 {
     return(ByteUtil.ReadUInt16(this));
 }
예제 #14
0
 public void WriteFloat(float num)
 {
     ByteUtil.WriteFloat(num, this);
 }
예제 #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));
 }
예제 #16
0
 public void WriteDouble(double num)
 {
     ByteUtil.WriteDouble(num, this);
 }
예제 #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));
 }