Package java.io

Examples of java.io.RandomAccessFile.readInt()


            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)
            throw new IOException("log file 2 " + file2.getName() + " is not a Bitronix Log file (incorrect header)");
        long timestamp2 = activeRandomAccessFile.readLong();
        activeRandomAccessFile.close();
View Full Code Here


      }

      @Override
      public int readInt() throws IOException
      {
        return f.readInt();
      }

      @Override
      public boolean readBoolean() throws IOException
      {
View Full Code Here

    in.seek(0);
    // note: this is the only place where we use in.readInt()
    // directly; afterwards, the detected byte order
    // is regarded via this class' methods readInt() and readShort()
    // methods
    int magic = in.readInt();
    if (magic == MAGIC_INTEL)
    {
      setByteOrder(BYTE_ORDER_INTEL);
    }
    else
View Full Code Here

      if (tag != null)
      {
        result.append(tag);
      }
    }
    nextIfdOffset = in.readInt();
    return result;
  }

  /**
   * Reads a 32 bit signed integer value, regarding the current byte order.
View Full Code Here

   * @see #getByteOrder
   */
  private int readInt() throws IOException
  {
    RandomAccessFile in = getRandomAccessFile();
    int result = in.readInt();
    if (getByteOrder() == BYTE_ORDER_INTEL)
    {
      int r1 = (result >> 24) & 0xff;
      int r2 = (result >> 16) & 0xff;
      int r3 = (result >> 8) & 0xff;
View Full Code Here

      Object value;

      if (type.getFormat() == ProgramFieldType.TEXT_FORMAT) {
        value = dataFile.readUTF();
      } else {
        int n = dataFile.readInt();

        byte[] b = new byte[n];
        dataFile.readFully(b);

        value = b;
View Full Code Here

            Object key = OperationKey.newKey(dirName, name);

            Operation op = null;
            if (optype == Operation.SAVE) {
              byte buf[] = new byte[logFile.readInt()];
              logFile.readFully(buf);
              op = Operation.alloc(optype, dirName, name, buf);
              op = (Operation) templog.put(key, op);
            } else {
              op = Operation.alloc(optype, dirName, name);
View Full Code Here

    public void test_readInt() throws IOException {
        // Test for method int java.io.RandomAccessFile.readInt()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeInt(Integer.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect int read/written", Integer.MIN_VALUE, raf
                .readInt());
        raf.close();
    }

    /**
 
View Full Code Here

    public void test_writeIntI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeInt(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeInt(Integer.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect int read/written", Integer.MIN_VALUE, raf
                .readInt());
        raf.close();
    }

    /**
 
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.