Package java.io

Examples of java.io.RandomAccessFile.readInt()


                    int[][] index = pis.getIndex();
                    is.close();
                   
                    RandomAccessFile raf = new RandomAccessFile(shape + ".shp", "rw");
                    raf.seek(24);
                    int contentLength = raf.readInt();
                   
                    int indexedContentLength = index[0][index[0].length - 1] + index[1][index[1].length - 1];
                   
                    if (contentLength != indexedContentLength) {
                        System.out.println(shape + " content length - shp: " + contentLength + ", shx: " + indexedContentLength);
View Full Code Here


      File metaDataFile = Serialization.getMetaDataFile(file);
      if(metaDataFile.exists()) {
        return new LogFileV3.MetaDataWriter(file, logFileID);
      }
      logFile = new RandomAccessFile(file, "r");
      int version = logFile.readInt();
      if(Serialization.VERSION_2 == version) {
        return new LogFileV2.MetaDataWriter(file, logFileID);
      }
      throw new IOException("File " + file + " has bad version " +
          Integer.toHexString(version));
View Full Code Here

      // the metadata file exists and as such it's V3
      if(logFile.length() == 0L || metaDataFile.exists()) {
        return new LogFileV3.RandomReader(file, encryptionKeyProvider,
          fsyncPerTransaction);
      }
      int version = logFile.readInt();
      if(Serialization.VERSION_2 == version) {
        return new LogFileV2.RandomReader(file);
      }
      throw new IOException("File " + file + " has bad version " +
          Integer.toHexString(version));
View Full Code Here

        }
        return new LogFileV3.SequentialReader(file, encryptionKeyProvider,
          fsyncPerTransaction);
      }
      logFile = new RandomAccessFile(file, "r");
      int version = logFile.readInt();
      if(Serialization.VERSION_2 == version) {
        return new LogFileV2.SequentialReader(file);
      }
      throw new IOException("File " + file + " has bad version " +
          Integer.toHexString(version));
View Full Code Here

    protected MetaDataWriter(File file, int logFileID) throws IOException {
      super(file, logFileID);
      boolean error = true;
      try {
        RandomAccessFile writeFileHandle = getFileHandle();
        int version = writeFileHandle.readInt();
        if (version != getVersion()) {
          throw new IOException("The version of log file: "
              + file.getCanonicalPath() + " is different from expected "
              + " version: expected = " + getVersion() + ", found = " + version);
        }
View Full Code Here

        if (version != getVersion()) {
          throw new IOException("The version of log file: "
              + file.getCanonicalPath() + " is different from expected "
              + " version: expected = " + getVersion() + ", found = " + version);
        }
        int fid = writeFileHandle.readInt();
        if (fid != logFileID) {
          throw new IOException("The file id of log file: "
              + file.getCanonicalPath() + " is different from expected "
              + " id: expected = " + logFileID + ", found = " + fid);
        }
View Full Code Here

    SequentialReader(File file)
        throws EOFException, IOException {
      super(file, null);
      RandomAccessFile fileHandle = getFileHandle();
      int version = fileHandle.readInt();
      if(version != getVersion()) {
        throw new IOException("Version is " + Integer.toHexString(version) +
            " expected " + Integer.toHexString(getVersion())
            + " file: " + file.getCanonicalPath());
      }
View Full Code Here

      if(version != getVersion()) {
        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() {
View Full Code Here

                while(true) {
                    index.readFully(keyMd5);
                    position = index.readInt();

                    data.seek(position);
                    int size = data.readInt();
                    byte[] value = new byte[size];
                    data.readFully(value);
                    System.out.println(ByteUtils.toHexString(keyMd5) + "\t=>\t"
                                       + serializer.toObject(value).toString());
                }
View Full Code Here

    // check the layout version inside the image file
    File oldF = new File(oldImageDir, "fsimage");
    RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws");
    try {
      oldFile.seek(0);
      int odlVersion = oldFile.readInt();
      if (odlVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        return false;
    } finally {
      oldFile.close();
    }
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.