Examples of reposition()


Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

        pss.reposition(9);
        assertEquals('j', pss.read());
        pss.reposition(25);
        assertEquals('z', pss.read());
        assertEquals(-1, pss.read());
        pss.reposition(1);
        assertEquals('b', pss.read());
        pss.reposition(1);
        assertEquals('b', pss.read());
    }
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

        pss.reposition(25);
        assertEquals('z', pss.read());
        assertEquals(-1, pss.read());
        pss.reposition(1);
        assertEquals('b', pss.read());
        pss.reposition(1);
        assertEquals('b', pss.read());
    }

    /**
     * A regression test for DERBY-3735.
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

            pss.read(b);
            println("Position at iteration " + i + ": " + pss.getPosition());
        }
        // This failed, because we tried skipping more bytes than there are in
        // the stream to get to position 0.
        pss.reposition(0);
    }

    /**
     * Tests that trying to move past the end of the stream leaves the stream
     * object in a consistent state, and can be repositioned again after the
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

            throws IOException, StandardException {
        final long size = 10;
        InputStream in = new LoopingAlphabetStream(size);
        PositionedStoreStream pss = new PositionedStoreStream(in);
        assertEquals("Invalid initial position", 0L, pss.getPosition());
        pss.reposition(size -1); // Goto end.
        assertEquals(size -1, pss.getPosition());
        assertEquals('j', pss.read());
        assertEquals(size, pss.getPosition());
        assertEquals(-1, pss.read());
        // This step is crucial, position must be different than zero when the
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

        assertEquals('j', pss.read());
        assertEquals(size, pss.getPosition());
        assertEquals(-1, pss.read());
        // This step is crucial, position must be different than zero when the
        // first exception below is thrown.
        pss.reposition(size / 2); // Goto middle.
        assertEquals(size / 2, pss.getPosition());
        try {
            pss.reposition(size *2); // Try to go past end.
            fail("Should have failed with EOFException");
        } catch (EOFException eofe) {
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

        // This step is crucial, position must be different than zero when the
        // first exception below is thrown.
        pss.reposition(size / 2); // Goto middle.
        assertEquals(size / 2, pss.getPosition());
        try {
            pss.reposition(size *2); // Try to go past end.
            fail("Should have failed with EOFException");
        } catch (EOFException eofe) {
            // Ignore this exception
        }
        // Failed here before, because internal state was inconsistent.
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

            // Ignore this exception
        }
        // Failed here before, because internal state was inconsistent.
        // Assumed: pos = 5, underlying stream at pos 5, skipped (size -1 - pos)
        // Actual: pos = 5, underlying stream at pos (size -1)
        pss.reposition(size -1); // Goto end.
        assertEquals(size -1, pss.getPosition());
        assertEquals('j', pss.read());
    }

    public static Test suite() {
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

            assertEquals(127, pss.read(b, 0, 256));
            assertEquals(-1, pss.read(b, 127, 10));
            assertEquals(-1, b[127]);
            assertTrue( -1 != b[126]);
            assertEquals('a', b[0]);
            pss.reposition(0);
        }
    }

    public void testRepositionForwards()
            throws IOException, StandardException {
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

        PositionedStoreStream pss = new PositionedStoreStream(in);
        assertEquals(0, pss.getPosition());
        //  Position forwards one by one.
        for (int i=0; i < length; i++) {
            InputStream inComp = new LoopingAlphabetStream(length);
            pss.reposition(i);
            inComp.skip(i);
            assertEquals(inComp.read(), pss.read());
        }
        // Position forwards two by two.
        for (int i=1; i < length; i += 2) {
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.reposition()

            assertEquals(inComp.read(), pss.read());
        }
        // Position forwards two by two.
        for (int i=1; i < length; i += 2) {
            InputStream inComp = new LoopingAlphabetStream(length);
            pss.reposition(i);
            inComp.skip(i);
            assertEquals(inComp.read(), pss.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.