use of org.apache.jena.tdb.base.StorageException in project jena by apache.
the class BufferChannelMem method write.
// Invert : write(ByteBuffer) = write(ByteBuffer,posn)
@Override
public synchronized int write(ByteBuffer buffer, long loc) {
checkIfClosed();
if (TRACKING)
log("write<<@" + loc);
if (loc < 0 || loc > bytes.limit())
// Can write at loc = bytes()
throw new StorageException("Out of range(" + name + "[write]): " + loc + " [0," + bytes.limit() + ")");
int x = bytes.position();
bytes.position((int) loc);
int len = write(buffer);
bytes.position(x);
if (TRACKING)
log("write>>@" + loc);
return len;
}
use of org.apache.jena.tdb.base.StorageException in project jena by apache.
the class RecordRangeIterator method hasNext.
@Override
public boolean hasNext() {
if (slot != null)
return true;
if (currentPage == null)
return false;
// Set slot.
while (currentIdx >= currentPage.getCount()) {
// Move to next.
int link = currentPage.getLink();
if (link < 0) {
close();
return false;
}
if (currentPage != null)
pageMgr.release(currentPage);
RecordBufferPage nextPage = pageMgr.getReadIterator(link);
// Check currentPage -> nextPage is strictly increasing keys.
Record r1 = currentPage.getRecordBuffer().getHigh();
Record r2 = nextPage.getRecordBuffer().getLow();
if (Record.keyGE(r1, r2))
throw new StorageException("RecordRangeIterator: records not strictly increasing: " + r1 + " // " + r2);
currentPage = nextPage;
countBlocks++;
currentIdx = 0;
}
slot = currentPage.getRecordBuffer().get(currentIdx);
currentIdx++;
if (maxRec != null && Record.keyGE(slot, maxRec)) {
close();
return false;
}
if (slot == null) {
close();
return false;
}
countRecords++;
return true;
}
Aggregations