public byte[] readDataBlock(int blockNo) throws IOException { assert(blockNo >= 0 && blockNo < dataBlockCount); return parent.readSegmentDataBlock(segNo, blockNo); }
assertEquals(storage.segments[0].checkBlockCount, 3); assertEquals(storage.segments[0].crossCheckBlockCount, 0); assertTrue(Arrays.equals(storage.readSegmentDataBlock(0, 0), Arrays.copyOfRange(originalData, 0, CHKBlock.DATA_LENGTH))); int truncateLength = (int) (size % CHKBlock.DATA_LENGTH); long offsetLastBlock = size - truncateLength; byte[] buf = storage.readSegmentDataBlock(0, 1); assert(buf.length == CHKBlock.DATA_LENGTH); byte[] truncated = Arrays.copyOfRange(buf, 0, truncateLength);