Code example for ByteArrayInputStream

Methods: availableread

        assertEquals("Bytes written, not buffered", 0, bais.available());
        bais = new ByteArrayInputStream(baos.toByteArray());
        assertEquals("Bytes not written after flush", 500, bais.available());
        os.write(fileString.getBytes(), 500, 513);
        bais = new ByteArrayInputStream(baos.toByteArray());
        assertTrue("Bytes not written when buffer full",
                bais.available() >= 1000);
        byte[] wbytes = new byte[1013];, 0, 1013);
        assertEquals("Incorrect bytes written", new String(wbytes, 0,
                wbytes.length), fileString.substring(0, 1013));
        // regression test for HARMONY-4177 
        MockOutputStream mos = new MockOutputStream(5);
        BufferedOutputStream bos = new BufferedOutputStream(mos, 3);
        assertEquals("Large data should be written directly", "abcde", mos
Stop searching for code, let great code find you!  Add Codota to your java IDE