private void innerEncode(MemoryLimitedChunk chunk) {
try {
synchronized(this) {
if(cancelled) return;
}
if(logMINOR) Logger.minor(this, "Encoding "+this);
byte[][] dataBlocks = readDataBlocks();
byte[][] checkBlocks = new byte[crossCheckBlockCount][];
for(int i=0;i<checkBlocks.length;i++)
checkBlocks[i] = new byte[CHKBlock.DATA_LENGTH];
if(dataBlocks == null || checkBlocks == null) return;
parent.codec.encode(dataBlocks, checkBlocks, new boolean[checkBlocks.length], CHKBlock.DATA_LENGTH);
writeCheckBlocks(checkBlocks);
synchronized(this) {
encoded = true;
}
if(logMINOR) Logger.minor(this, "Finished encoding "+this);
storeStatus();
} catch (IOException e) {
parent.failOnDiskError(e);
}
}