示例#1
0
 /** 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;
   }
 }
示例#2
0
 /** Mark the file as empty. */
 public void clear() {
   freeSpace.clear();
 }
示例#3
0
 long getFirstFree() {
   return freeSpace.getFirstFree();
 }
示例#4
0
 public int getFillRate() {
   return freeSpace.getFillRate();
 }
示例#5
0
 /**
  * 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);
 }
示例#6
0
 /**
  * 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);
 }
示例#7
0
 /**
  * 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);
 }