Package java.io

Examples of java.io.RandomAccessFile.readInt()


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

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

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

    long fileLen = files[0].length();
    LOG.debug("Corrupting Log File: " + files[0] + " len: " + fileLen);
    RandomAccessFile rwf = new RandomAccessFile(files[0], "rw");
    rwf.seek(fileLen-4); // seek to checksum bytes
    int b = rwf.readInt();
    rwf.seek(fileLen-4);
    rwf.writeInt(b+1);
    rwf.close();
   
    FSEditLog editlog = getFSEditLog(storage);
View Full Code Here

 
      long fileLen = editFile.length();
      LOG.debug("Corrupting Log File: " + 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();
    }
   
View Full Code Here

      // writeInt/readInt
      raf.seek(0);
      raf.writeInt(12345);
      raf.seek(0);
      harness.check(raf.readInt(), 12345, "writeInt(l)/readInt()");

      // readUnsignedByte/readUnsignedShort
      raf.seek(2);
      harness.check(raf.readUnsignedByte(), 48, "readUnsignedByte()");
      raf.seek(2);
View Full Code Here

    protected byte readDataItemSize(DataItem item) throws IOException {

        RandomAccessFile file = dataManager.getDataFile(item);
        file.seek(item.getOffset()); // jump to the size field
        byte rc = file.readByte();
        item.setSize(file.readInt());
        return rc;
    }
   
    protected Object readItem(Marshaller marshaller,StoreLocation item) throws IOException{
        RandomAccessFile file=dataManager.getDataFile(item);
View Full Code Here

    long fileLen = editFile.length();
    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 {
View Full Code Here

    this.setAir = setAir;
    this.restoreAfterUnload = restoreAfterUnload;
    RandomAccessFile raf = new RandomAccessFile(new File(filePath),"r");
    this.filePath = filePath;
   
    int framecount = raf.readInt();//how much frames?
    fa = new Frame[framecount];
    int xx = loc.getBlockX();
    int yy = loc.getBlockY();
    int zz = loc.getBlockZ();
    if(forEditor){xx=0;yy=0;zz=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.