Package java.nio

Examples of java.nio.ShortBuffer.position()


    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 10).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray());
View Full Code Here


    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray2() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5, (short) 5));
        assertEquals(10, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4, 5, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray3() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        try {
            notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5, (short) 5, (short) 5));
            fail();
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 10).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray2() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5, (short) 5));
        assertEquals(10, notBackedByArray.length());
        assertArrayEquals(new short[]{1, 1, 2, 1, 2, 3, 3, 4, 5, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray3() throws Exception {
        ShortBuffer buffer = ByteBuffer.allocateDirect(Short.SIZE / Byte.SIZE * 11).asShortBuffer();
        buffer.position(1).limit(9);
        BoundedShortArray notBackedByArray = BoundedShortArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        try {
            notBackedByArray.addAll(ShortArray.unsafeValueOf((short) 5, (short) 5, (short) 5));
            fail();
View Full Code Here

             */
            int stringPtr = sbuffer.get() & 0xffff;
            for (int i=0; i<numRecords; i++) {
                short platformID = sbuffer.get();
                if (platformID != MS_PLATFORM_ID) {
                    sbuffer.position(sbuffer.position()+5);
                    continue; // skip over this record.
                }
                short encodingID = sbuffer.get();
                short langID     = sbuffer.get();
                short nameID     = sbuffer.get();
View Full Code Here

             */
            int stringPtr = sbuffer.get() & 0xffff;
            for (int i=0; i<numRecords; i++) {
                short platformID = sbuffer.get();
                if (platformID != MS_PLATFORM_ID) {
                    sbuffer.position(sbuffer.position()+5);
                    continue; // skip over this record.
                }
                short encodingID = sbuffer.get();
                short langID     = sbuffer.get();
                short nameID     = sbuffer.get();
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.