}
private void pageOutSegments(final FixedSegments paged, final int beginPage, final int endPage)
throws IOException {
final int[][] blockRef = _block;
final FastMultiByteArrayOutputStream buf = new FastMultiByteArrayOutputStream(DEFAULT_EXTENT_SIZE);
for(int i = beginPage; i <= endPage; i += DEFAULT_EXTENT_THRESHOLD) {
final int pages;
if((i + DEFAULT_EXTENT_THRESHOLD - 1) > endPage) {
break;
} else {
pages = DEFAULT_EXTENT_THRESHOLD;
}
int addr = i;
final int limit = Math.min(i + pages, blockRef.length - 1);
for(int p = i; p < limit; p++) {
final int[] ref = blockRef[p];
if(ref == null) {
if(buf.size() > 0) {
final byte[] b = buf.toByteArray();
buf.reset();
paged.bulkWrite(addr, b);
}
} else {
if(buf.size() == 0) {
addr = p;
}
buf.writeInts(ref, 0, ref.length);
blockRef[p] = null;
}
}
if(buf.size() > 0) {
final byte[] b = buf.toByteArray();
buf.reset();
paged.bulkWrite(i, b);
}
}
buf.close();
paged.flush(false);
if(LOG.isInfoEnabled()) {
LOG.info("paged out docuemnt table seqment(" + beginPage + " - " + endPage
+ ") to disk: " + paged.getFile().getAbsolutePath());
}