Package java.io

Examples of java.io.RandomAccessFile.writeChar()


        // a different VM could get the same file name.
        try
        {
            RandomAccessFile file;
            file = new RandomAccessFile(exceptionFile, "rw");
            file.writeChar('t');
            file.close();
        }
        catch (Exception ex)
        {
            // ignore
View Full Code Here


     * @throws Exception if failed
     */
    @Test
    public void testReadChar() throws Exception {
        RandomAccessFile file = file();
        file.writeChar('a');
        file.writeChar(0xa000);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
        assertThat(buf.readChar(), is('a'));
View Full Code Here

     */
    @Test
    public void testReadChar() throws Exception {
        RandomAccessFile file = file();
        file.writeChar('a');
        file.writeChar(0xa000);
        file.seek(0);

        BufferedFileInput buf = manage(new BufferedFileInput(file, 256));
        assertThat(buf.readChar(), is('a'));
        assertThat(buf.readChar(), is((char) 0xa000));
View Full Code Here

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

View Full Code Here

     * @tests java.io.RandomAccessFile#writeChar(int)
     */
    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();
    }

View Full Code Here

     * @tests java.io.RandomAccessFile#writeChar(int)
     */
    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();
    }

View Full Code Here

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

View Full Code Here

      raf.seek(0);
      harness.check(raf.readLine(), "foobar", "writeBytes(s)/readLine()");

      // writeChar(c)/writeChars(s)/readChar()
      raf.seek(0);
      raf.writeChar('f');
      raf.writeChars("oobar");
      raf.seek(0);

      String s = "";
View Full Code Here

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

View Full Code Here

     * @tests java.io.RandomAccessFile#writeChar(int)
     */
    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();
    }

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.