Package java.io

Examples of java.io.RandomAccessFile.readChar()


        buf.flush();

        file.seek(0);
        String expect = "Hello, world!";
        for (char e : expect.toCharArray()) {
            char c = file.readChar();
            assertThat(c, is(e));
        }

        eof(file);
    }
View Full Code Here


        buf.writeChar('a');
        buf.writeChar('\ua000');
        buf.flush();

        file.seek(0);
        assertThat(file.readChar(), is('a'));
        assertThat(file.readChar(), is('\ua000'));

        eof(file);
    }
View Full Code Here

        buf.writeChar('\ua000');
        buf.flush();

        file.seek(0);
        assertThat(file.readChar(), is('a'));
        assertThat(file.readChar(), is('\ua000'));

        eof(file);
    }

    /**
 
View Full Code Here

    public void test_readChar() throws IOException {
        // Test for method char java.io.RandomAccessFile.readChar()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeChar('T');
        raf.seek(0);
        assertEquals("Incorrect char read/written", 'T', raf.readChar());
        raf.close();
    }

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

    public void test_writeCharI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeChar(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeChar('T');
        raf.seek(0);
        assertEquals("Incorrect char read/written", 'T', raf.readChar());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#writeChars(java.lang.String)
View Full Code Here

        raf.writeChars("HelloWorld");
        char[] hchars = new char[10];
        "HelloWorld".getChars(0, 10, hchars, 0);
        raf.seek(0);
        for (int i = 0; i < hchars.length; i++)
            assertEquals("Incorrect string written", hchars[i], raf.readChar());
        raf.close();
    }

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

    public void test_writeCharI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeChar(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeChar('T');
        raf.seek(0);
        assertEquals("Incorrect char read/written", 'T', raf.readChar());
        raf.close();
    }

    /**
     * @tests java.io.RandomAccessFile#writeChars(java.lang.String)
View Full Code Here

        raf.writeChars("HelloWorld");
        char[] hchars = new char[10];
        "HelloWorld".getChars(0, 10, hchars, 0);
        raf.seek(0);
        for (int i = 0; i < hchars.length; i++)
            assertEquals("Incorrect string written", hchars[i], raf.readChar());
        raf.close();
    }

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

    public void test_readChar() throws IOException {
        // Test for method char java.io.RandomAccessFile.readChar()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeChar('T');
        raf.seek(0);
        assertEquals("Incorrect char read/written", 'T', raf.readChar());
        raf.close();
    }

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

      raf.seek(0);

      String s = "";

      for (int i = 0; i < 6; i++)
        s += raf.readChar();

      harness.check(s, "foobar", "writeChar/writeChars/readChar()");

      // writeLong/readLong
      raf.seek(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.