Package java.io

Examples of java.io.ByteArrayInputStream.available()


        }

        byte[] buffer2 = new byte[] { 'a', 'b', 'c', 'd' };
        buffos.write(buffer2, 0, 4);
        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", 14, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here


        buffos.write(buffer2, 0, 4);
        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", 14, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
            assertEquals(buffer[i], byteArrayis.read());
        }
        for (int i = 0; i < 4; i++) {
View Full Code Here

        buffos.close();

        byte[] buffer3 = new byte[] { 'e', 'f', 'g', 'h', 'i' };
        buffos.write(buffer3, 0, 5);
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 14, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 19, byteArrayis
                .available());
        for (int i = 0; i < 10; i++) {
View Full Code Here

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

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

        buffos.write(new byte[] { 'j', 'k' });
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 19, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 21, byteArrayis
                .available());
    }
View Full Code Here

        buffos.write(new byte[] { 'j', 'k' });
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes written, not buffered", 19, byteArrayis.available());
        buffos.flush();
        byteArrayis = new ByteArrayInputStream(byteArrayos.toByteArray());
        assertEquals("Bytes not written after flush", 21, byteArrayis
                .available());
    }

    public void test_write_Scenario3() throws IOException {
        ByteArrayOutputStream byteArrayos = new ByteArrayOutputStream();
View Full Code Here

                                ByteArrayInputStream bais =
                                    convertAsByteArrayInputStream( stream );
                               
                                if (SanityManager.DEBUG) {
                  trace("parameter value is a LOB with length:" +
                      bais.available() );
                }
                               
                ps.setBinaryStream(i+1,
                                                   bais,
                           bais.available() );
View Full Code Here

                      bais.available() );
                }
                               
                ps.setBinaryStream(i+1,
                                                   bais,
                           bais.available() );
                               
              }
             
            }
            break;
View Full Code Here



    private void verifyReceivedMessage(Message inMessage, String content) {
        ByteArrayInputStream bis = (ByteArrayInputStream)inMessage.getContent(InputStream.class);
        byte bytes[] = new byte[bis.available()];
        try {
            bis.read(bytes);
        } catch (IOException ex) {
            assertFalse("Read the Destination recieved Message error ", false);
            ex.printStackTrace();
View Full Code Here

        verifyReceivedMessage("HelloWorld");
    }

    public void verifyReceivedMessage(String content) {
        ByteArrayInputStream bis = (ByteArrayInputStream)inMessage.getContent(InputStream.class);
        byte bytes[] = new byte[bis.available()];
        try {
            bis.read(bytes);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
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.