throws IOException, StorageFormatException {
this.segNo = segNo;
this.parent = parent;
this.dataBlocks = dis.readInt();
if(dataBlocks < 1 || dataBlocks > 256)
throw new StorageFormatException("Bad data block count");
this.crossSegmentCheckBlocks = dis.readInt();
// REDFLAG one day we will support more than 256 blocks per segment?
if(crossSegmentCheckBlocks < 0 || crossSegmentCheckBlocks > 256)
throw new StorageFormatException("Bad cross-segment check block count");
this.checkBlocks = dis.readInt();
if(checkBlocks < 0 || checkBlocks > 256)
throw new StorageFormatException("Bad check block count");
int total = dataBlocks+checkBlocks+crossSegmentCheckBlocks;
if(total > 256)
throw new StorageFormatException("Too many blocks in segment");
boolean ignoreLastBlock =
(segNo == parent.segments.length-1 && parent.lastBlockMightNotBePadded());
blockChooser = new SplitFileFetcherSegmentBlockChooser(total, parent.random,
parent.maxRetries, parent.cooldownTries, parent.cooldownLength,
this, keysFetching, ignoreLastBlock ? dataBlocks - 1 : -1);