Package java.io

Examples of java.io.RandomAccessFile.writeByte()


      raf.seek(0);
      raf.write(12);
      raf.seek(0);
      harness.check(raf.readByte(), 12, "write(byte)/readByte(), positive");
      raf.seek(0);
      raf.writeByte(-12);
      raf.seek(0);
      harness.check(raf.readByte(), -12, "writeByte(byte)/readByte(), negative");

      // writeBoolean/readBoolean
      raf.seek(0);
View Full Code Here


    RandomAccessFile raf = new RandomAccessFile(file, "rw");
    try {
      raf.seek(offset);
      int origByte = raf.read();
      raf.seek(offset);
      raf.writeByte(origByte - 1);
    } finally {
      IOUtils.closeStream(raf);
    }
  }
View Full Code Here

      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

                if(preblock.m.getId() != nowmat || preblock.data != nowdata ){
                  raf.writeInt(nowx);
                  raf.writeInt(nowy);
                  raf.writeInt(nowz);
                  raf.writeInt(nowmat);
                  raf.writeByte(nowdata);
                }else{
                  blockcount--;
                }
              }else{
                raf.writeInt(nowx);
View Full Code Here

              }else{
                raf.writeInt(nowx);
                raf.writeInt(nowy);
                raf.writeInt(nowz);
                raf.writeInt(nowmat);
                raf.writeByte(nowdata);
              }
            }else{
              raf.writeInt(nowx);
              raf.writeInt(nowy);
              raf.writeInt(nowz);
View Full Code Here

            }else{
              raf.writeInt(nowx);
              raf.writeInt(nowy);
              raf.writeInt(nowz);
              raf.writeInt(nowmat);
              raf.writeByte(nowdata);
            }
          } 
        }
      }
      sender.sendMessage(blockcount + " blocks");
View Full Code Here

          for(int zz = minz;zz<=maxz;zz++){
            raf.writeInt(xx-pos1.getBlockX());
            raf.writeInt(yy-pos1.getBlockY());
            raf.writeInt(zz-pos1.getBlockZ());
            raf.writeInt(w.getBlockAt(xx, yy, zz).getType().getId());
            raf.writeByte(w.getBlockAt(xx, yy, zz).getData());
         
        }
      }
     
      raf.write(ba);//write back rest
View Full Code Here

            raf = new RandomAccessFile(logfile, "rw");

            raf.seek(TransactionLogHeader.FORMAT_ID_HEADER);
            raf.writeInt(BitronixXid.FORMAT_ID);
            raf.writeLong(System.currentTimeMillis());
            raf.writeByte(TransactionLogHeader.CLEAN_LOG_STATE);
            raf.writeLong((long) TransactionLogHeader.HEADER_LENGTH);

            byte[] buffer = new byte[4096];
            int length = (maxLogSizeInMb *1024 *1024) /4096;
            for(int i=0; i<length ;i++) {
View Full Code Here

      }

      @Override
      public void writeByte(byte b) throws IOException
      {
        f.writeByte(b);
      }

      @Override
      public void writeInt(int i) throws IOException
      {
View Full Code Here

     * @tests java.io.RandomAccessFile#readByte()
     */
    public void test_readByte() throws IOException {
        // Test for method byte java.io.RandomAccessFile.readByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect bytes read/written", 127, raf.readByte());
        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.