Package java.io

Examples of java.io.RandomAccessFile.readInt()


    if (oldFile == null)
      throw new IOException("Cannot read file: " + oldF);
    FileLock oldLock = oldFile.getChannel().tryLock();
    try {
      oldFile.seek(0);
      int odlVersion = oldFile.readInt();
      if (odlVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        return false;
    } finally {
      oldLock.release();
      oldFile.close();
View Full Code Here


    if (oldLock == null)
      throw new IOException("Cannot lock file: " + oldF);
    String odlStorageID = "";
    try {
      oldFile.seek(0);
      int odlVersion = oldFile.readInt();
      if (odlVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        throw new IncorrectVersionException(odlVersion, "file " + oldF,
                                            LAST_PRE_UPGRADE_LAYOUT_VERSION);
      odlStorageID = org.apache.hadoop.io.UTF8.readString(oldFile);
 
View Full Code Here

    // Lock and Read old storage file
    RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws");
    FileLock oldLock = oldFile.getChannel().tryLock();
    try {
      oldFile.seek(0);
      int oldVersion = oldFile.readInt();
      if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        return false;
    } finally {
      oldLock.release();
      oldFile.close();
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 oldVersion = oldFile.readInt();
      oldFile.close();
      oldFile = null;
      if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        return false;
    } finally {
View Full Code Here

    // Lock and Read old storage file
    RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws");
    FileLock oldLock = oldFile.getChannel().tryLock();
    try {
      oldFile.seek(0);
      int oldVersion = oldFile.readInt();
      if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
        return false;
    } finally {
      oldLock.release();
      oldFile.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

    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

            int recOffset[] = new int[header.numRecords];
            byte recAttrs[] = new byte[header.numRecords];

            for (int i = 0; i < header.numRecords; i++) {

                recOffset[i] = file.readInt();

                // read in attributes (1 byte) + unique id (3 bytes)
                // take away the unique id, store the attributes

                int attr = file.readInt();
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.