Example #1
0
        private Chunk getChunk(System.IO.Stream inputStream)
        {
            Chunk chunk = new Chunk();

            chunk.SetLength(GetLong(inputStream));                   // The length of the data chunk.
            chunk.SetType(GetBytes(inputStream, 4));                 // The chunk type.
            chunk.SetData(GetBytes(inputStream, chunk.GetLength())); // The chunk data.
            chunk.SetCrc(GetLong(inputStream));                      // CRC of the type and data chunks.
            if (!chunk.hasGoodCRC())
            {
                throw new Exception("Chunk has bad CRC.");
            }
            return(chunk);
        }
Example #2
0
        private Chunk getChunk(Stream inputStream)
        {
            Chunk chunk = new Chunk();

            chunk.SetLength(this.GetLong(inputStream));
            chunk.SetType(this.GetBytes(inputStream, 4L));
            chunk.SetData(this.GetBytes(inputStream, chunk.GetLength()));
            chunk.SetCrc(this.GetLong(inputStream));
            if (!chunk.hasGoodCRC())
            {
                throw new Exception("Chunk has bad CRC.");
            }
            return(chunk);
        }
Example #3
0
 private Chunk getChunk(System.IO.Stream inputStream)
 {
     Chunk chunk = new Chunk();
     chunk.SetLength(GetLong(inputStream));      // The length of the data chunk.
     chunk.SetType(GetBytes(inputStream, 4));    // The chunk type.
     chunk.SetData(GetBytes(inputStream, chunk.GetLength()));    // The chunk data.
     chunk.SetCrc(GetLong(inputStream));         // CRC of the type and data chunks.
     if (!chunk.hasGoodCRC()) {
     throw new Exception("Chunk has bad CRC.");
     }
     return chunk;
 }