Code example for FilterOutputStream

Methods: writewrite

0
        } 
    } 
 
    public void test_write$BII() throws IOException { 
        Support_OutputStream sos = new Support_OutputStream(testLength);
        os = new FilterOutputStream(sos);
        os.write(fileString.getBytes(), 10, testLength - 10);
 
        bis = new ByteArrayInputStream(sos.toByteArray());
        assertTrue("Test 1: Bytes have not been written.",
                bis.available() == testLength - 10);
        byte[] wbytes = new byte[testLength - 10];
        bis.read(wbytes);
        assertTrue("Test 2: Incorrect bytes written or read.",
                fileString.substring(10).equals(new String(wbytes)));
 
        try { 
            // Support_OutputStream throws an IOException if the internal 
            // buffer is full, which it should be eventually. 
            os.write(fileString.getBytes());
            fail("Test 2: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    } 
Connect your IDE to all the code out there  Get Codota for Java