Package java.nio

Examples of java.nio.ShortBuffer.order()


        assertNotSame(buf, readonly);
        assertTrue(readonly.isReadOnly());
        assertEquals(buf.position(), readonly.position());
        assertEquals(buf.limit(), readonly.limit());
        assertEquals(buf.isDirect(), readonly.isDirect());
        assertEquals(buf.order(), readonly.order());
        assertContentEquals(buf, readonly);

        // readonly's position, mark, and limit should be independent to buf
        readonly.reset();
        assertEquals(readonly.position(), 0);
View Full Code Here


        assertNotSame(buf, duplicate);
        assertEquals(buf.position(), duplicate.position());
        assertEquals(buf.limit(), duplicate.limit());
        assertEquals(buf.isReadOnly(), duplicate.isReadOnly());
        assertEquals(buf.isDirect(), duplicate.isDirect());
        assertEquals(buf.order(), duplicate.order());
        assertContentEquals(buf, duplicate);

        // duplicate's position, mark, and limit should be independent to buf
        duplicate.reset();
        assertEquals(duplicate.position(), 0);
View Full Code Here

        buf.limit(buf.capacity() - 1);

        ShortBuffer slice = buf.slice();
        assertEquals(buf.isReadOnly(), slice.isReadOnly());
        assertEquals(buf.isDirect(), slice.isDirect());
        assertEquals(buf.order(), slice.order());
        assertEquals(slice.position(), 0);
        assertEquals(slice.limit(), buf.remaining());
        assertEquals(slice.capacity(), buf.remaining());
        try {
            slice.reset();
View Full Code Here

        // test BIG_ENDIAN short buffer, read
        buf.clear();
        buf.order(ByteOrder.BIG_ENDIAN);
        shortBuffer = buf.asShortBuffer();
        assertSame(ByteOrder.BIG_ENDIAN, shortBuffer.order());
        while (shortBuffer.remaining() > 0) {
            buf.get(bytes);
            value = shortBuffer.get();
            assertEquals(bytes2short(bytes, buf.order()), value);
        }
View Full Code Here

        // test LITTLE_ENDIAN short buffer, read
        buf.clear();
        buf.order(ByteOrder.LITTLE_ENDIAN);
        shortBuffer = buf.asShortBuffer();
        assertSame(ByteOrder.LITTLE_ENDIAN, shortBuffer.order());
        while (shortBuffer.remaining() > 0) {
            buf.get(bytes);
            value = shortBuffer.get();
            assertEquals(bytes2short(bytes, buf.order()), value);
        }
View Full Code Here

        if (!buf.isReadOnly()) {
            // test BIG_ENDIAN short buffer, write
            buf.clear();
            buf.order(ByteOrder.BIG_ENDIAN);
            shortBuffer = buf.asShortBuffer();
            assertSame(ByteOrder.BIG_ENDIAN, shortBuffer.order());
            while (shortBuffer.remaining() > 0) {
                value = (short) shortBuffer.remaining();
                shortBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, short2bytes(value, buf.order())));
View Full Code Here

            // test LITTLE_ENDIAN short buffer, write
            buf.clear();
            buf.order(ByteOrder.LITTLE_ENDIAN);
            shortBuffer = buf.asShortBuffer();
            assertSame(ByteOrder.LITTLE_ENDIAN, shortBuffer.order());
            while (shortBuffer.remaining() > 0) {
                value = (short) shortBuffer.remaining();
                shortBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, short2bytes(value, buf.order())));
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.