예제 #1
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));
 }
예제 #2
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))
 {
 }