public static BlockAccessor decode(BlockAccessor block)
{
byte[] data = new byte[block.Length];
if (block.Read(data,0,(int)block.Length) != block.Length) {
throw new Exception("BlockAccessor partial read");
}
MemoryStream ms = new MemoryStream(data);
BinaryReader reader = new BinaryReader(ms);
UInt32 uncompressed_length = reader.ReadUInt32();
byte[] uncompressed_data = new byte[uncompressed_length];
GZipInputStream uncompressed_stream = new GZipInputStream(ms);
if (uncompressed_stream.Read(uncompressed_data, 0, (int)uncompressed_length)
!= uncompressed_length) {
throw new Exception("GZipInputStream partial read");
}
return new BlockAccessor(uncompressed_data);
}