Package java.io

Examples of java.io.RandomAccessFile.writeInt()


      raf.writeLong(storeSize);
      raf.writeLong(prevStoreSize);
      raf.writeLong(keyCount.get());
      raf.writeInt(generation);
      raf.writeInt(flags);
      raf.writeInt(0); // bloomFilterK
      raf.writeInt(0);
      raf.writeLong(0);
      raf.writeLong(writes.get());
      raf.writeLong(hits.get());
View Full Code Here


      raf.writeLong(storeSize);
      raf.writeLong(prevStoreSize);
      raf.writeLong(keyCount.get());
      raf.writeInt(generation);
      raf.writeInt(flags);
      raf.writeInt(0); // bloomFilterK
      raf.writeInt(0);
      raf.writeLong(0);
      raf.writeLong(writes.get());
      raf.writeLong(hits.get());
      raf.writeLong(misses.get());
View Full Code Here

      raf.writeLong(prevStoreSize);
      raf.writeLong(keyCount.get());
      raf.writeInt(generation);
      raf.writeInt(flags);
      raf.writeInt(0); // bloomFilterK
      raf.writeInt(0);
      raf.writeLong(0);
      raf.writeLong(writes.get());
      raf.writeLong(hits.get());
      raf.writeLong(misses.get());
      raf.writeLong(bloomFalsePos.get());
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void testReadInt() throws Exception {
        RandomAccessFile file = file();
        file.writeInt(100);
        file.writeInt(-100);
        file.writeInt(0x12345678);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
View Full Code Here

     */
    @Test
    public void testReadInt() throws Exception {
        RandomAccessFile file = file();
        file.writeInt(100);
        file.writeInt(-100);
        file.writeInt(0x12345678);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
        assertThat(buf.readInt(), is(100));
View Full Code Here

    @Test
    public void testReadInt() throws Exception {
        RandomAccessFile file = file();
        file.writeInt(100);
        file.writeInt(-100);
        file.writeInt(0x12345678);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
        assertThat(buf.readInt(), is(100));
        assertThat(buf.readInt(), is(-100));
View Full Code Here

              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

            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

   */
  private void corruptAfterStartSegment(File f) throws IOException {
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
    raf.seek(0x16); // skip version and first tranaction and a bit of next transaction
    for (int i = 0; i < 1000; i++) {
      raf.writeInt(0xdeadbeef);
    }
    raf.close();
  }
 
  @Test(expected=IllegalStateException.class)
View Full Code Here

     * @tests java.io.RandomAccessFile#readInt()
     */
    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

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.