public SplitFileInserterSegmentStorage(SplitFileInserterStorage parent, int segNo,
boolean persistent, int dataBlocks, int checkBlocks, int crossCheckBlocks, int keyLength,
byte splitfileCryptoAlgorithm, byte[] splitfileCryptoKey, Random random, int maxRetries,
int consecutiveRNFsCountAsSuccess, KeysFetchingLocally keysFetching) {
this.parent = parent;
this.segNo = segNo;
this.dataBlockCount = dataBlocks;
this.checkBlockCount = checkBlocks;
this.crossCheckBlockCount = crossCheckBlocks;
totalBlockCount = dataBlockCount + crossCheckBlockCount + checkBlockCount;
this.keyLength = keyLength;
crossSegmentBlockSegments = new SplitFileInserterCrossSegmentStorage[crossCheckBlocks];
crossSegmentBlockNumbers = new int[crossCheckBlocks];
blocksHaveKeys = new boolean[totalBlockCount];
this.splitfileCryptoAlgorithm = splitfileCryptoAlgorithm;
this.splitfileCryptoKey = splitfileCryptoKey;
crossDataBlocksAllocated = new boolean[dataBlocks + crossCheckBlocks];
blockChooser = new SplitFileInserterSegmentBlockChooser(this, totalBlockCount, random,
maxRetries, keysFetching, consecutiveRNFsCountAsSuccess);
try {
CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
DataOutputStream dos = new DataOutputStream(cos);
innerStoreStatus(dos);
dos.close();
statusLength = (int) cos.written() + parent.checker.checksumLength();
} catch (IOException e) {
throw new Error(e);
}
}