Package org.persvr.util

Examples of org.persvr.util.BufferedDataInput


   * current location in the database is returned
   *
   * @return value from the database
   */
  Object readEntity(boolean historic, boolean mustFinish) throws IOException {
    return readEntity(new BufferedDataInput(getTransactionsReadFile()), historic, mustFinish);
  }
View Full Code Here


    Long lastTransaction = tableLastChange.get(getTableId("Transaction"));
    if (lastTransaction != null) {
      transactionLogFile.seek(lastTransaction > 0 ? lastTransaction : 0);
      try {
        // run through each history until an exception is thrown
        BufferedDataInput bdi = new BufferedDataInput(transactionLogFile);
        while (true) {
          //TODO: update the status file with table changes as we read them, including both the last reference and any higher IDs
          readEntity(bdi, true, true);
          lastTransaction = bdi.getFilePointer();
        }
      } catch (EOFException e) {
        //normal
      } catch (Throwable e) {
        log.debug("recovering database",e);
View Full Code Here

    }
    return raf;
  }

  void readNames() throws IOException {
    BufferedDataInput namesInput = new BufferedDataInput(namesFile);
    while (namesInput.getFilePointer() < namesInput.length()) {
      int pointer = (int) namesInput.getFilePointer();
      byte block = namesInput.readByte();
      String propName = namesInput.readString();
      switch (block) {
      case NAMES_HEADER_TABLE_NAME:
      case NAMES_HEADER_SUB_TABLE_NAME:
        tableNameIds.put(propName, pointer);
        internedStrings.put(pointer, propName);
View Full Code Here

    private IndexNode(long reference) throws IOException {
      this.reference = reference;
      RandomAccessFile rafile = getIndexFile();
      rafile.seek(reference);
      BufferedDataInput bdi = new BufferedDataInput(rafile);
      readHeader(bdi);
      List<IndexEntry> entriesList = new ArrayList<IndexEntry>(100);
      Object upperBound;
      while ((upperBound = readEntity(bdi, false, false)) != END_OF_LIST) {

        byte start;
        do {
          // see it is a reference first
          bdi.mark();
          start = bdi.readByte();
          bdi.goBackOne();
          if (start == HEADER_INDEX_REFERENCE_INTEGER || start == HEADER_INDEX_REFERENCE_LONG) {
            // it is a reference, continue
            reference = readVarLong(bdi);
            entriesList.add((IndexEntry) (depth == 0 ? new IndexEntry(upperBound, reference) : new BranchEntry(upperBound, reference,
                readVarLong(bdi))));
          } else
            break;
        } while (true);
        //TODO: Make the last one a special entry that records the size of the linked list 
      }
      allDescendants = bdi.readLong();
      entries = new IndexEntry[entriesList.size()];
      entriesList.toArray(entries);
    }
View Full Code Here

TOP

Related Classes of org.persvr.util.BufferedDataInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.