public void WriteUInt32(uint num) { ByteUtil.WriteUInt32(num, this); }
public void WriteUInt64(ulong num) { ByteUtil.WriteUInt64(num, this); }
/// <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)) { }
public void WriteUInt16(ushort num) { ByteUtil.WriteUInt16(num, this); }
/// <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)); }
/// <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)); }
public string ReadUtf8(int lengthBytes) { return(ByteUtil.ReadUtf8(this, lengthBytes)); }
/// <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)); }
public float ReadFloat() { return(ByteUtil.ReadFloat(this)); }
public double ReadDouble() { return(ByteUtil.ReadDouble(this)); }
public ulong ReadUInt64() { return(ByteUtil.ReadUInt64(this)); }
public uint ReadUInt32() { return(ByteUtil.ReadUInt32(this)); }
public ushort ReadUInt16() { return(ByteUtil.ReadUInt16(this)); }
public void WriteFloat(float num) { ByteUtil.WriteFloat(num, this); }
/// <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)); }
public void WriteDouble(double num) { ByteUtil.WriteDouble(num, this); }
/// <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)); }