Package org.apache.derby.client.am

Examples of org.apache.derby.client.am.ByteArrayCombinerStream


        super(name);
    }

    public void testCombineNullRead()
            throws IOException {
        combiner = new ByteArrayCombinerStream(null, 0);
        assertEquals(-1, combiner.read());
    }
View Full Code Here


        assertEquals(-1, combiner.read());
    }

    public void testCombineNullReadArray()
            throws IOException {
        combiner = new ByteArrayCombinerStream(null, 0);
        assertEquals(-1, combiner.read(new byte[10], 0, 10));
    }
View Full Code Here

        assertEquals(-1, combiner.read(new byte[10], 0, 10));
    }

    public void testCombineAvailableNull()
            throws IOException {
        combiner = new ByteArrayCombinerStream(null, 0);
        assertEquals(0, combiner.available());
    }
View Full Code Here

    public void testCombineAvailable4bytes()
            throws IOException {
        byte[] array = {65,66,77,79};
        ArrayList list = new ArrayList(1);
        list.add(array);
        combiner = new ByteArrayCombinerStream(list, 4);
        assertEquals(4, combiner.available());
    }
View Full Code Here

            throws IOException {
        byte[] array = {65,66,77,79};
        ArrayList list = new ArrayList(2);
        list.add(array);
        list.add(new byte[4]);
        combiner = new ByteArrayCombinerStream(list, array.length);
        byte[] resArray = new byte[array.length];
        assertEquals(array.length,
                     combiner.read(resArray, 0, resArray.length));
        assertTrue(combiner.read() == -1);
    }
View Full Code Here

    public void testCombineOneArray()
            throws IOException {
        ArrayList list = new ArrayList(1);
        list.add(defaultArray);
        combiner = new ByteArrayCombinerStream(list, defaultArray.length);
        byte[] resArray = new byte[defaultArray.length];
        assertEquals(defaultArray.length,
                     combiner.read(resArray,0, resArray.length));
        assertTrue(combiner.read() == -1);
        assertTrue(Arrays.equals(defaultArray, resArray));
View Full Code Here

        int offset = 0;
        for (int i=0; i < arrays; i++) {
            System.arraycopy(array, 0, targetArray, offset, array.length);
            offset += array.length;
        }
        combiner = new ByteArrayCombinerStream(list, length);
        byte[] resArray = new byte[(int)length];
        assertEquals(length, combiner.read(resArray, 0, resArray.length));
        assertTrue(combiner.read() == -1);
        assertTrue(combiner.read() == -1);
        assertTrue(Arrays.equals(targetArray, resArray));
View Full Code Here

        list.add(defaultArray);
        byte[] targetArray = new byte[length];
        System.arraycopy(defaultArray, 0,
                         targetArray, 0, length);
        byte[] resArray = new byte[length];
        combiner = new ByteArrayCombinerStream(list, length);
        assertEquals(length, combiner.read(resArray, 0, length));
        assertTrue(combiner.read() == -1);
        assertTrue(Arrays.equals(targetArray, resArray));
    }
View Full Code Here

                         targetArray, 0, defaultArray.length);
        System.arraycopy(defaultArray, 0,
                         targetArray, defaultArray.length,
                         length - defaultArray.length);
        byte[] resArray = new byte[length];
        combiner = new ByteArrayCombinerStream(list, length);
        assertEquals(length, combiner.read(resArray, 0, length));
        assertTrue(combiner.read() == -1);
        assertTrue(Arrays.equals(targetArray, resArray));
    }
View Full Code Here

     */
    public void testTooLittleDataNoCombine() {
        ArrayList list = new ArrayList(1);
        list.add(new byte[5]);
        try {
            combiner = new ByteArrayCombinerStream(list, 10);
            fail("An IllegalArgumentException singalling too little data " +
                    "should have been thrown");
        } catch (IllegalArgumentException iae) {
            // This should happen, continue.
        }
View Full Code Here

TOP

Related Classes of org.apache.derby.client.am.ByteArrayCombinerStream

Copyright © 2018 www.massapicom. 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.