Example #1
0
 public void openAppend() {
   if (!datafile.hasLock()) {
     throw new RuntimeException(
         PrintTools.sprintf("Should lock file before append %s", datafile.getName()));
   }
   datafile.openAppend();
 }
Example #2
0
 protected static void out(String s, Object... args) throws IOException {
   if (out == null) {
     systemout.println(sprintf(s, args));
   } else {
     out.printf(s + "\n", args);
     out.flush();
   }
 }
Example #3
0
 public static void print(String s) throws IOException {
   if (out == null) {
     systemout.println(s);
   } else {
     out.printf(s + "\n");
     out.flush();
   }
 }
Example #4
0
 public boolean findFirstRecord() {
   if (getOffset() == 0 && getOffset() < getCeiling()) {
     return true;
   }
   ByteSearchPosition matchPos = datafile.matchPos(root.section);
   if (matchPos.found()) {
     datafile.movePast(matchPos);
     return getOffset() < getCeiling();
   }
   return false;
 }
Example #5
0
 public void openWrite() {
   checkFirstUse();
   if (root.writeenabled() && datafile != null) {
     datafile.openWrite();
     if (hasHeader) {
       root.writeHeader();
     }
   }
 }
Example #6
0
 public void openRead() {
   checkFirstUse();
   if (datafile != null) {
     if (reader == null) {
       reader = datafile.rwbuffer;
     }
     datafile.openRead();
     if (hasHeader) {
       ByteSearchSection section = reader.readSectionStart(root.section);
       if (section.notEmpty()) {
         root.readHeader(section);
         reader.movePast(section);
       }
     }
   }
 }
Example #7
0
 public boolean hasMore() {
   return datafile.hasMore();
 }
Example #8
0
 public void setBufferSize(int buffersize) {
   datafile.setBufferSize(buffersize);
 }
Example #9
0
 public void setOffset(long offset) {
   datafile.setOffset(offset);
 }
Example #10
0
 public void setCeiling(long ceiling) {
   datafile.setCeiling(ceiling);
 }
Example #11
0
 public long getCeiling() {
   return datafile.getCeiling();
 }
Example #12
0
 public void closeWrite() {
   if (datafile != null) {
     datafile.closeWrite();
   }
 }
Example #13
0
 public void unlock() {
   datafile.unlock();
 }
Example #14
0
 public boolean lock() {
   return datafile.lock();
 }
Example #15
0
 public boolean exists() {
   return datafile.existsDir();
 }
Example #16
0
 public void delete() {
   datafile.delete();
 }
Example #17
0
 public long getLength() {
   return datafile.getLength();
 }
Example #18
0
 public void resetStart() {
   if (datafile != null) {
     datafile.resetStart();
   }
 }
Example #19
0
 public long getOffset() {
   return datafile.getOffset();
 }
Example #20
0
 public void closeRead() {
   if (datafile != null) {
     datafile.closeRead();
   }
 }