long getEntryOffset(long ledger, long entry) throws IOException { int offsetInPage = (int) (entry % entriesPerPage); // find the id of the first entry of the page that has the entry // we are looking for long pageEntry = entry - offsetInPage; LedgerEntryPage lep = getLedgerEntryPage(ledger, pageEntry, false); try { if (lep == null) { lep = grabLedgerEntryPage(ledger, pageEntry); } return lep.getOffset(offsetInPage * LedgerEntryPage.getIndexEntrySize()); } finally { if (lep != null) { lep.releasePage(); } } }