/** * Write a page. * * @param pageId the page id * @param data the data */ public synchronized void writePage(int pageId, Data data) { if (pageId <= 0) { DbException.throwInternalError("write to page " + pageId); } byte[] bytes = data.getBytes(); if (SysProperties.CHECK) { boolean shouldBeFreeList = (pageId - PAGE_ID_FREE_LIST_ROOT) % freeListPagesPerList == 0; boolean isFreeList = bytes[0] == Page.TYPE_FREE_LIST; if (bytes[0] != 0 && shouldBeFreeList != isFreeList) { throw DbException.throwInternalError(); } } checksumSet(bytes, pageId); file.seek((long) pageId << pageSizeShift); file.write(bytes, 0, pageSize); writeCount++; }
/** * Write a page. * * @param pageId the page id * @param data the data */ public synchronized void writePage(int pageId, Data data) { if (pageId <= 0) { DbException.throwInternalError("write to page " + pageId); } byte[] bytes = data.getBytes(); if (SysProperties.CHECK) { boolean shouldBeFreeList = (pageId - PAGE_ID_FREE_LIST_ROOT) % freeListPagesPerList == 0; boolean isFreeList = bytes[0] == Page.TYPE_FREE_LIST; if (bytes[0] != 0 && shouldBeFreeList != isFreeList) { throw DbException.throwInternalError(); } } checksumSet(bytes, pageId); file.seek((long) pageId << pageSizeShift); file.write(bytes, 0, pageSize); writeCount++; }
/** * Write a page. * * @param pageId the page id * @param data the data */ public synchronized void writePage(int pageId, Data data) { if (pageId <= 0) { DbException.throwInternalError("write to page " + pageId); } byte[] bytes = data.getBytes(); if (SysProperties.CHECK) { boolean shouldBeFreeList = (pageId - PAGE_ID_FREE_LIST_ROOT) % freeListPagesPerList == 0; boolean isFreeList = bytes[0] == Page.TYPE_FREE_LIST; if (bytes[0] != 0 && shouldBeFreeList != isFreeList) { throw DbException.throwInternalError(); } } checksumSet(bytes, pageId); file.seek((long) pageId << pageSizeShift); file.write(bytes, 0, pageSize); writeCount++; }