Package java.io

Examples of java.io.ByteArrayInputStream.available()


            assertEquals(buffer[i], byteArrayis.read());
        }

        buffos.write(buffer, 0, 5);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 9, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 9, byteArrayis
                .available());
        for (int i = 0; i < 4; i++) {
View Full Code Here


        buffos.write(buffer, 0, 5);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 9, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 9, byteArrayis
                .available());
        for (int i = 0; i < 4; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
        for (int i = 0; i < 5; i++) {
View Full Code Here

        byte[] buffer = "1234567890".getBytes("UTF-8");

        BufferedOutputStream buffos = new BufferedOutputStream(byteArrayos, 10);
        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 10, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 10, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 10, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 10, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
View Full Code Here

            assertEquals(buffer[i], byteArrayis.read());
        }

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 20, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 20, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 20, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 20, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
        for (int i = 0; i < 10; i++) {
View Full Code Here

            assertEquals(buffer[i], byteArrayis.read());
        }

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 30, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 30, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 30, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 30, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
        for (int i = 0; i < 10; i++) {
View Full Code Here

        byte[] buffer = "1234567890".getBytes("UTF-8");

        BufferedOutputStream buffos = new BufferedOutputStream(byteArrayos, 20);
        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 0, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 10, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here

        buffos.write(buffer, 0, 10);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 0, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 10, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
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.