/** Close this store. */ public void close() { try { if (fileLock != null) { fileLock.release(); fileLock = null; } file.close(); freeSpace.clear(); } catch (Exception e) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_WRITING_FAILED, "Closing failed for file {0}", fileName, e); } finally { file = null; } }
/** Mark the file as empty. */ public void clear() { freeSpace.clear(); }
long getFirstFree() { return freeSpace.getFirstFree(); }
public int getFillRate() { return freeSpace.getFillRate(); }
/** * Mark the space as free. * * @param pos the position in bytes * @param length the number of bytes */ public void free(long pos, int length) { freeSpace.free(pos, length); }
/** * Allocate a number of blocks and mark them as used. * * @param length the number of bytes to allocate * @return the start position in bytes */ public long allocate(int length) { return freeSpace.allocate(length); }
/** * Mark the space as in use. * * @param pos the position in bytes * @param length the number of bytes */ public void markUsed(long pos, int length) { freeSpace.markUsed(pos, length); }