Package java.io

Examples of java.io.RandomAccessFile.writeInt()


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


    System.out.println("File name: " + editFile + " len: " + fileLen);
    RandomAccessFile rwf = new RandomAccessFile(editFile, "rw");
    rwf.seek(fileLen-4); // seek to checksum bytes
    int b = rwf.readInt();
    rwf.seek(fileLen-4);
    rwf.writeInt(b+1);
    rwf.close();
   
    try {
      cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATA_NODES).format(false).build();
      fail("should not be able to start");
View Full Code Here

  public void save() throws IOException{
    File file = new File(filePath);
    file.delete();
    file.createNewFile();
    RandomAccessFile raf = new RandomAccessFile(filePath,"rw");
    raf.writeInt(frameCount());
    //write all blocks of this frame
    for(int f = 0; f < fa.length;f++){
      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
View Full Code Here

    file.createNewFile();
    RandomAccessFile raf = new RandomAccessFile(filePath,"rw");
    raf.writeInt(frameCount());
    //write all blocks of this frame
    for(int f = 0; f < fa.length;f++){
      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
        raf.writeInt(fa[f].mba[b].y);
        raf.writeInt(fa[f].mba[b].z);
        raf.writeInt(fa[f].mba[b].m.getId());
View Full Code Here

    raf.writeInt(frameCount());
    //write all blocks of this frame
    for(int f = 0; f < fa.length;f++){
      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
        raf.writeInt(fa[f].mba[b].y);
        raf.writeInt(fa[f].mba[b].z);
        raf.writeInt(fa[f].mba[b].m.getId());
        raf.writeByte(fa[f].mba[b].data);
      }
View Full Code Here

    //write all blocks of this frame
    for(int f = 0; f < fa.length;f++){
      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
        raf.writeInt(fa[f].mba[b].y);
        raf.writeInt(fa[f].mba[b].z);
        raf.writeInt(fa[f].mba[b].m.getId());
        raf.writeByte(fa[f].mba[b].data);
      }
    }
View Full Code Here

    for(int f = 0; f < fa.length;f++){
      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
        raf.writeInt(fa[f].mba[b].y);
        raf.writeInt(fa[f].mba[b].z);
        raf.writeInt(fa[f].mba[b].m.getId());
        raf.writeByte(fa[f].mba[b].data);
      }
    }
    raf.close();
View Full Code Here

      raf.writeInt(fa[f].mba.length);
      for(int b = 0;b< fa[f].mba.length;b++){
        raf.writeInt(fa[f].mba[b].x);
        raf.writeInt(fa[f].mba[b].y);
        raf.writeInt(fa[f].mba[b].z);
        raf.writeInt(fa[f].mba[b].m.getId());
        raf.writeByte(fa[f].mba[b].data);
      }
    }
    raf.close();
  }
View Full Code Here

    }else if(newfile == null && file == null){
      throw new IllegalArgumentException("You have to provide a file for saving!");
    }
    RandomAccessFile raf = new RandomAccessFile(file, "rw");
    raf.writeUTF(fileID);
    raf.writeInt(fileVersion);
   
    raf.writeInt(getFrameCount());
    long dict = raf.getFilePointer();
    for(int i = 0; i < getFrameCount(); i++){
      raf.writeLong(0); //initing dictionary with 0
View Full Code Here

    }
    RandomAccessFile raf = new RandomAccessFile(file, "rw");
    raf.writeUTF(fileID);
    raf.writeInt(fileVersion);
   
    raf.writeInt(getFrameCount());
    long dict = raf.getFilePointer();
    for(int i = 0; i < getFrameCount(); i++){
      raf.writeLong(0); //initing dictionary with 0
    }
    int f = 0;
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.