Package java.io

Examples of java.io.RandomAccessFile.readInt()


          storeSize = raf.readLong();
          if(storeSize <= 0) throw new IOException("Bogus datastore size");
          prevStoreSize = raf.readLong();
          keyCount.set(raf.readLong());
          generation = raf.readInt();
          flags = raf.readInt();

          if (((flags & FLAG_DIRTY) != 0) &&
              // FIXME figure out a way to do this consistently!
              // Not critical as a few blocks wrong is something we can handle.
View Full Code Here


          storeSize = raf.readLong();
          if(storeSize <= 0) throw new IOException("Bogus datastore size");
          prevStoreSize = raf.readLong();
          keyCount.set(raf.readLong());
          generation = raf.readInt();
          flags = raf.readInt();

          if (((flags & FLAG_DIRTY) != 0) &&
              // FIXME figure out a way to do this consistently!
              // Not critical as a few blocks wrong is something we can handle.
              ResizablePersistentIntBuffer.getPersistenceTime() != -1)
View Full Code Here

              // Not critical as a few blocks wrong is something we can handle.
              ResizablePersistentIntBuffer.getPersistenceTime() != -1)
            flags |= FLAG_REBUILD_BLOOM;

          try {
            raf.readInt(); // bloomFilterK
            raf.readInt(); // reserved
            raf.readLong(); // reserved
            long w = raf.readLong();
            writes.set(w);
            initialWrites = w;
View Full Code Here

              ResizablePersistentIntBuffer.getPersistenceTime() != -1)
            flags |= FLAG_REBUILD_BLOOM;

          try {
            raf.readInt(); // bloomFilterK
            raf.readInt(); // reserved
            raf.readLong(); // reserved
            long w = raf.readLong();
            writes.set(w);
            initialWrites = w;
            Logger.normal(this, "Set writes to saved value "+w);
View Full Code Here

        buf.writeInt(-100);
        buf.writeInt(0x12345678);
        buf.flush();

        file.seek(0);
        assertThat(file.readInt(), is(100));
        assertThat(file.readInt(), is(-100));
        assertThat(file.readInt(), is(0x12345678));

        eof(file);
    }
View Full Code Here

        buf.writeInt(0x12345678);
        buf.flush();

        file.seek(0);
        assertThat(file.readInt(), is(100));
        assertThat(file.readInt(), is(-100));
        assertThat(file.readInt(), is(0x12345678));

        eof(file);
    }
View Full Code Here

        buf.flush();

        file.seek(0);
        assertThat(file.readInt(), is(100));
        assertThat(file.readInt(), is(-100));
        assertThat(file.readInt(), is(0x12345678));

        eof(file);
    }

    /**
 
View Full Code Here

              // Corrupt
              File f = blocks[idx];
              long seekPos = f.length()/2;
              RandomAccessFile raf = new RandomAccessFile(f, "rw");
              raf.seek(seekPos);
              int data = raf.readInt();
              raf.seek(seekPos);
              raf.writeInt(data+1);
              LOG.info("Corrupted block " + blocks[idx]);
              numCorrupted++;
            }
View Full Code Here

              !blocks[idx].getName().endsWith(".meta")) {
            // Corrupt
            File f = blocks[idx];
            RandomAccessFile raf = new RandomAccessFile(f, "rw");
            raf.seek(offset);
            int data = raf.readInt();
            raf.seek(offset);
            raf.writeInt(data+1);
            LOG.info("Corrupted block " + blocks[idx]);
          }
        }
View Full Code Here

    RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws");
    if (oldFile == null)
      throw new IOException("Cannot read file: " + oldF);
    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.