示例#1
0
  private void open(String path) throws FileNotFoundException, IOException {
    this.path = path;
    this.file = new File(this.path + ".hfile");
    boolean isNew = this.file.exists() == false || this.file.length() < _memHeadReserved;

    if (isNew) {
      this.memBuffer = new byte[_memHeadReserved + memBufferSize];
      this.memBuffer[0] = (byte) 0xCA;
      this.memBuffer[1] = (byte) 0xFE;
    } else {
      this.memBufferSize = (int) (this.file.length() - _memHeadReserved);
      this.memBuffer = FileUtil.readAll(this.file);
      this.count = DataInputX.toInt(this.memBuffer, _countPos);
    }

    FlushCtr.getInstance().regist(this);
  }
示例#2
0
 public void close() {
   FlushCtr.getInstance().unregist(this);
 }