Package com.fasterxml.util.membuf

Examples of com.fasterxml.util.membuf.StreamyBytesMemBuffer.skip()


        assertFalse(buffer.isEmpty());

        // then skip all of it, in different order
        int left = 15;
        for (int i = 0; i <= 5; ++i) {
            assertEquals(i, buffer.skip(i));
            left -= i;
            assertEquals(left, buffer.getTotalPayloadLength());
        }
        assertEquals(0, buffer.getTotalPayloadLength());
        assertTrue(buffer.isEmpty());
View Full Code Here


        }
        assertEquals(0, buffer.getTotalPayloadLength());
        assertTrue(buffer.isEmpty());

        // and when empty, nothing more:
        assertEquals(0, buffer.skip(100));
        assertTrue(buffer.isEmpty());
    }

    private void _testStreamySkipAndRead(SegType aType) throws Exception
    {
View Full Code Here

        }
        assertEquals(15, buffer.getTotalPayloadLength());
        assertFalse(buffer.isEmpty());

        // then skip all of it
        assertEquals(5, buffer.skip(5));
        byte[] b = new byte[4];
        assertEquals(4, buffer.read(b));
        assertEquals(6, buffer.getTotalPayloadLength());
        assertEquals(6, buffer.skip(100));
        assertEquals(0, buffer.skip(100));
View Full Code Here

        // then skip all of it
        assertEquals(5, buffer.skip(5));
        byte[] b = new byte[4];
        assertEquals(4, buffer.read(b));
        assertEquals(6, buffer.getTotalPayloadLength());
        assertEquals(6, buffer.skip(100));
        assertEquals(0, buffer.skip(100));
        assertTrue(buffer.isEmpty());
    }

    // Test to verify that skip works across buffer boundaries
View Full Code Here

        assertEquals(5, buffer.skip(5));
        byte[] b = new byte[4];
        assertEquals(4, buffer.read(b));
        assertEquals(6, buffer.getTotalPayloadLength());
        assertEquals(6, buffer.skip(100));
        assertEquals(0, buffer.skip(100));
        assertTrue(buffer.isEmpty());
    }

    // Test to verify that skip works across buffer boundaries
    private void _testStreamyLongerSkip(SegType aType) throws Exception
View Full Code Here

    // Test to verify that skip works across buffer boundaries
    private void _testStreamyLongerSkip(SegType aType) throws Exception
    {
        final StreamyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createStreamyBuffer(1, 3);
        buffer.append(new byte[30]);
        assertEquals(30, buffer.skip(32));
        assertEquals(0, buffer.skip(1));
        assertTrue(buffer.isEmpty());
    }
}
View Full Code Here

    private void _testStreamyLongerSkip(SegType aType) throws Exception
    {
        final StreamyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createStreamyBuffer(1, 3);
        buffer.append(new byte[30]);
        assertEquals(30, buffer.skip(32));
        assertEquals(0, buffer.skip(1));
        assertTrue(buffer.isEmpty());
    }
}
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.