Code example for ByteArrayOutputStream

Methods: resetsizewrite

0
 
    /** 
     * @tests java.io.ByteArrayOutputStream#reset() 
     */ 
    public void test_reset() { 
        bos = new java.io.ByteArrayOutputStream();
        bos.write(fileString.getBytes(), 0, 100);
        bos.reset();
        assertEquals("reset failed", 0, bos.size());
    } 
 
    /** 
     * @tests java.io.ByteArrayOutputStream#size() 
     */ 
    public void test_size() { 
        bos = new java.io.ByteArrayOutputStream();
        bos.write(fileString.getBytes(), 0, 100);
        assertEquals("size test failed", 100, bos.size());
        bos.reset();
        assertEquals("size test failed", 0, bos.size());