Package java.io

Examples of java.io.RandomAccessFile.readUnsignedByte()


      dataStream = new RandomAccessFile(filename, "r");

      // gets the header for file type identification
      int[] header = new int[4];
      for (int i = 0; i < header.length; i++)
        header[i] = dataStream.readUnsignedByte();

      // finds the right object
      int format = 0;
      for (format = 0; format < FORMATS.length; format++) {
        if (Arrays.equals(header, MAGIC_BYTES[format]))
View Full Code Here


  RandomAccessFile f = files[currentEl / (getInputSize() / files.length)];

  try {
      f.seek(id * (3072 + labelSize));
      if (labelSize > 1) {
    f.readUnsignedByte();
      }

      Util.fillArray(nextTarget, 0);
      nextTarget[f.readUnsignedByte()] = 1;

View Full Code Here

      if (labelSize > 1) {
    f.readUnsignedByte();
      }

      Util.fillArray(nextTarget, 0);
      nextTarget[f.readUnsignedByte()] = 1;

      f.readFully(nextInputRaw);
  } catch (IOException e) {
      e.printStackTrace();
  }
View Full Code Here

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

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

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

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

      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);
      harness.check(raf.readUnsignedShort(), 12345, "readUnsignedShort()");
    }
    catch (IOException e)
    {
View Full Code Here

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

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

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

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

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

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

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

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