Code example for PrintStream

Methods: write

0
    /** 
     * @tests java.io.PrintStream#write(byte[], int, int) 
     */ 
    public void test_write$BII() { 
        // Test for method void java.io.PrintStream.write(byte [], int, int) 
        PrintStream os = new PrintStream(bos, true);
        os.write(fileString.getBytes(), 0, fileString.length());
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte rbytes[] = new byte[4000];
        bis.read(rbytes, 0, fileString.length());
        assertTrue("Incorrect bytes written", new String(rbytes, 0, fileString
                .length()).equals(fileString));
    } 
 
    /** 
     * @tests java.io.PrintStream#write(int) 
     */ 
    public void test_writeI() { 
        // Test for method void java.io.PrintStream.write(int) 
        PrintStream os = new PrintStream(bos, true);
        os.write('t');