Package java.io

Examples of java.io.RandomAccessFile.readByte()


     */
    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{
View Full Code Here


        int z = raf.readInt()+zz;
        if(!forEditor){
          um.AddmyBlock(new myBlock(um.w.getBlockAt(x, y, z)));
        }
        @SuppressWarnings("deprecation")
        myBlock mb = new myBlock(x,y,z,Material.getMaterial(raf.readInt()),raf.readByte());
        mba[b] = mb;
      }
      fa[i]= new Frame(mba,um.w);
    }
    raf.close();
View Full Code Here

      for(int b = 0; b < blocks;b++){
        int x = raf.readInt()+xx;
        int y = raf.readInt()+yy;
        int z = raf.readInt()+zz;
        @SuppressWarnings("deprecation")
        myBlock mb = new myBlock(x,y,z,Material.getMaterial(raf.readInt()),raf.readByte());
        mba[b] = mb;
      }
      fa[i]= new Frame(mba,um.w);
    }
    raf.close();
View Full Code Here

          int blocks = raf.readInt();//build frame from all pre frames
          for(int b = 0; b < blocks;b++){
            int x = raf.readInt();
            int y = raf.readInt();
            int z = raf.readInt();
            myBlock mb = new myBlock(x,y,z,Material.getMaterial(raf.readInt()),raf.readByte());
            preblocks.add(mb);
          }
          //raf.seek(raf.getFilePointer()+17*blocks);//each block 4 ints and one byte = 17
        }
      }
View Full Code Here

      }*/
     
      rewrite = raf.getFilePointer();//store pos to write frame
      byte[] ba = new byte[(int)(raf.length()-rewrite)];
      for(int i =0;i<ba.length;i++){
        ba[i]= raf.readByte();
      }
      raf.seek(rewrite);
      //write all blocks of this frame
      int minx = Math.min(pos1.getBlockX(), pos2.getBlockX());
      int miny = Math.min(pos1.getBlockY(), pos2.getBlockY());
View Full Code Here

        raf.seek(raf.getFilePointer()+17*blocks);//each block 4 ints and one byte = 17
      }
      rewrite = raf.getFilePointer();//store pos to write frame
      byte[] ba = new byte[(int)(raf.length()-rewrite)];
      for(int i =0;i<ba.length;i++){
        ba[i]= raf.readByte();
      }
      raf.seek(rewrite);
      //write all blocks of this frame
      int minx = Math.min(pos1.getBlockX(), pos2.getBlockX());
      int miny = Math.min(pos1.getBlockY(), pos2.getBlockY());
View Full Code Here

      }

      @Override
      public byte readByte() throws IOException
      {
        return f.readByte();
      }

      @Override
      public int readInt() throws IOException
      {
View Full Code Here

      else
      if (type == TAG_TYPE_BYTE)
      {
        for (int i = 0; i < count; i++)
        {
          byte b = in.readByte();
          vector.addElement(new Byte(b));
        }
      }
      else
      if (type == TAG_TYPE_SHORT)
View Full Code Here

    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();
    }

    /**
     * @tests java.io.RandomAccessFile#readChar()
View Full Code Here

    public void test_writeByteI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeByte(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 127, raf.readByte());
        raf.close();
    }

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