// prepare to read from a stream public SegmentBlockDecoderRecordOffsetList(BlockAccessor datastream) { this.datastream = datastream; if (this.datastream.Length == 0) { throw new Exception("SegmentBlockDecoderRecordOffsetList: handed empty stream"); } // read the footer index size // FIXME: BUG BUG BUG!! using SeekOrigin.End is only valid here because our current RegionManager // is handing us a file. We need to decide if future Regionmanagers are going to explicitly // make "subregion" Streams, or whether we need to handle this differently. datastream.Seek(-4, SeekOrigin.End); // last 4 bytes of block BinaryReader r = new BinaryReader(datastream); number_of_records = r.ReadInt32(); Console.WriteLine("numrecords: " + number_of_records); }