Package java.io

Examples of java.io.RandomAccessFile.readLong()


    public void test_readLong() throws IOException {
        // Test for method long java.io.RandomAccessFile.readLong()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeLong(Long.MAX_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Long.MAX_VALUE, raf
                .readLong());
        raf.close();
    }

    /**
 
View Full Code Here


      int count = 0;
      do {
        ChangeRecord newRecord = new ChangeRecord();
        newRecord.changeLogFileName = fileName;
        newRecord.startOffset = raf.getFilePointer();
        newRecord.txid = raf.readLong();
        newRecord.type = raf.readShort();
        newRecord.timestamp = raf.readLong();
        newRecord.file = raf.readUTF();
        newRecord.endOffset = raf.getFilePointer();
        changes.add(newRecord);
View Full Code Here

        ChangeRecord newRecord = new ChangeRecord();
        newRecord.changeLogFileName = fileName;
        newRecord.startOffset = raf.getFilePointer();
        newRecord.txid = raf.readLong();
        newRecord.type = raf.readShort();
        newRecord.timestamp = raf.readLong();
        newRecord.file = raf.readUTF();
        newRecord.endOffset = raf.getFilePointer();
        changes.add(newRecord);
        count++;
      } while (count < MAX_ENTRIES_TO_READ && raf.getFilePointer() < raf.length());
View Full Code Here

        RandomAccessFile activeRandomAccessFile;
        activeRandomAccessFile = new RandomAccessFile(file1, "r");
        int formatId1 = activeRandomAccessFile.readInt();
        if (formatId1 != BitronixXid.FORMAT_ID)
            throw new IOException("log file 1 " + file1.getName() + " is not a Bitronix Log file (incorrect header)");
        long timestamp1 = activeRandomAccessFile.readLong();
        activeRandomAccessFile.close();

        activeRandomAccessFile = new RandomAccessFile(file2, "r");
        int formatId2 = activeRandomAccessFile.readInt();
        if (formatId2 != BitronixXid.FORMAT_ID)
View Full Code Here

        activeRandomAccessFile = new RandomAccessFile(file2, "r");
        int formatId2 = activeRandomAccessFile.readInt();
        if (formatId2 != BitronixXid.FORMAT_ID)
            throw new IOException("log file 2 " + file2.getName() + " is not a Bitronix Log file (incorrect header)");
        long timestamp2 = activeRandomAccessFile.readLong();
        activeRandomAccessFile.close();

        if (timestamp1 > timestamp2) {
            return file1;
        } else {
View Full Code Here

      if(metaDataExists) {
        return new EventQueueBackingStoreFileV3(checkpointFile, capacity,
          name, backupCheckpointDir, shouldBackup);
      }
      checkpointFileHandle = new RandomAccessFile(checkpointFile, "r");
      int version = (int)checkpointFileHandle.readLong();
      if(Serialization.VERSION_2 == version) {
        if(upgrade) {
          return upgrade(checkpointFile, capacity, name, backupCheckpointDir,
            shouldBackup);
        }
View Full Code Here

        if (fid != logFileID) {
          throw new IOException("The file id of log file: "
              + file.getCanonicalPath() + " is different from expected "
              + " id: expected = " + logFileID + ", found = " + fid);
        }
        setLastCheckpointOffset(writeFileHandle.readLong());
        setLastCheckpointWriteOrderID(writeFileHandle.readLong());
        LOGGER.info("File: " + file.getCanonicalPath() + " was last checkpointed "
            + "at position: " + getLastCheckpointOffset()
            + ", logWriteOrderID: " + getLastCheckpointWriteOrderID());
        error = false;
View Full Code Here

          throw new IOException("The file id of log file: "
              + file.getCanonicalPath() + " is different from expected "
              + " id: expected = " + logFileID + ", found = " + fid);
        }
        setLastCheckpointOffset(writeFileHandle.readLong());
        setLastCheckpointWriteOrderID(writeFileHandle.readLong());
        LOGGER.info("File: " + file.getCanonicalPath() + " was last checkpointed "
            + "at position: " + getLastCheckpointOffset()
            + ", logWriteOrderID: " + getLastCheckpointWriteOrderID());
        error = false;
      } finally {
View Full Code Here

        throw new IOException("Version is " + Integer.toHexString(version) +
            " expected " + Integer.toHexString(getVersion())
            + " file: " + file.getCanonicalPath());
      }
      setLogFileID(fileHandle.readInt());
      setLastCheckpointPosition(fileHandle.readLong());
      setLastCheckpointWriteOrderID(fileHandle.readLong());
    }
    @Override
    public int getVersion() {
      return Serialization.VERSION_2;
View Full Code Here

            " expected " + Integer.toHexString(getVersion())
            + " file: " + file.getCanonicalPath());
      }
      setLogFileID(fileHandle.readInt());
      setLastCheckpointPosition(fileHandle.readLong());
      setLastCheckpointWriteOrderID(fileHandle.readLong());
    }
    @Override
    public int getVersion() {
      return Serialization.VERSION_2;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.