Package java.io

Examples of java.io.RandomAccessFile.writeShort()


     */
    @Test
    public void testReadUnsignedShort() throws Exception {
        RandomAccessFile file = file();
        file.writeShort(100);
        file.writeShort(40000);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
        assertThat(buf.readUnsignedShort(), is(100));
        assertThat(buf.readUnsignedShort(), is(40000));
View Full Code Here


     * @tests java.io.RandomAccessFile#readShort()
     */
    public void test_readShort() throws IOException {
        // Test for method short java.io.RandomAccessFile.readShort()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(Short.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Short.MIN_VALUE, raf
                .readShort());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#readUnsignedShort()
     */
    public void test_readUnsignedShort() throws IOException {
        // Test for method int java.io.RandomAccessFile.readUnsignedShort()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(-1);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 65535, raf
                .readUnsignedShort());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#writeShort(int)
     */
    public void test_writeShortI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeShort(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(Short.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Short.MIN_VALUE, raf
                .readShort());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#writeShort(int)
     */
    public void test_writeShortI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeShort(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(Short.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Short.MIN_VALUE, raf
                .readShort());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#readShort()
     */
    public void test_readShort() throws IOException {
        // Test for method short java.io.RandomAccessFile.readShort()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(Short.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Short.MIN_VALUE, raf
                .readShort());
        raf.close();
    }
View Full Code Here

     * @tests java.io.RandomAccessFile#readUnsignedShort()
     */
    public void test_readUnsignedShort() throws IOException {
        // Test for method int java.io.RandomAccessFile.readUnsignedShort()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(-1);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 65535, raf
                .readUnsignedShort());
        raf.close();
    }
View Full Code Here

      harness.check(raf.readBoolean(), "writeBoolean(T)/readBoolean()");
      harness.check(!raf.readBoolean(), "writeBoolean(F)/readBoolean()");

      // writeShort/readShort
      raf.seek(0);
      raf.writeShort(527);
      raf.seek(0);
      harness.check(raf.readShort(), 527, "writeShort(n)/readShort()");

      // writeUTF/readUTF
      raf.seek(0);
View Full Code Here

    */
    if (out instanceof RandomAccessFile)
    {
      RandomAccessFile raf = (RandomAccessFile)out;
      raf.seek(compressedDataOffset);
      raf.writeShort((int)compressedSize);
    }
    else
    if (out instanceof SeekableByteArrayOutputStream)
    {
      SeekableByteArrayOutputStream sbaos = (SeekableByteArrayOutputStream)out;
View Full Code Here

     * @tests java.io.RandomAccessFile#readShort()
     */
    public void test_readShort() throws IOException {
        // Test for method short java.io.RandomAccessFile.readShort()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeShort(Short.MIN_VALUE);
        raf.seek(0);
        assertEquals("Incorrect long read/written", Short.MIN_VALUE, raf
                .readShort());
        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.