Package java.nio

Examples of java.nio.IntBuffer.order()


      IntBuffer pixelBuffer = pixmap.getPixels().asIntBuffer();
      int[] pixelsRGBA = new int[pixelBuffer.capacity()];
      pixelBuffer.get(pixelsRGBA);
      int[] pixelsARGBflipped = new int[pixelBuffer.capacity()];
      int pixel;
      if (pixelBuffer.order() == ByteOrder.BIG_ENDIAN) {
        for (int y = 0; y < pixmap.getHeight(); ++y) {
          for (int x = 0; x < pixmap.getWidth(); ++x) {
            pixel = pixelsRGBA[x + (y * pixmap.getWidth())];
            pixelsARGBflipped[x + ((pixmap.getHeight() - 1 - y) * pixmap.getWidth())] = ((pixel >> 8) & 0x00FFFFFF) | ((pixel << 24) & 0xFF000000);
          }
View Full Code Here


        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);

        IntBuffer 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 int buffer, read
        buf.clear();
        buf.order(ByteOrder.BIG_ENDIAN);
        intBuffer = buf.asIntBuffer();
        assertSame(ByteOrder.BIG_ENDIAN, intBuffer.order());
        while (intBuffer.remaining() > 0) {
            buf.get(bytes);
            value = intBuffer.get();
            assertEquals(bytes2int(bytes, buf.order()), value);
        }
View Full Code Here

        // test LITTLE_ENDIAN int buffer, read
        buf.clear();
        buf.order(ByteOrder.LITTLE_ENDIAN);
        intBuffer = buf.asIntBuffer();
        assertSame(ByteOrder.LITTLE_ENDIAN, intBuffer.order());
        while (intBuffer.remaining() > 0) {
            buf.get(bytes);
            value = intBuffer.get();
            assertEquals(bytes2int(bytes, buf.order()), value);
        }
View Full Code Here

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

            // test LITTLE_ENDIAN int buffer, write
            buf.clear();
            buf.order(ByteOrder.LITTLE_ENDIAN);
            intBuffer = buf.asIntBuffer();
            assertSame(ByteOrder.LITTLE_ENDIAN, intBuffer.order());
            while (intBuffer.remaining() > 0) {
                value = (int) intBuffer.remaining();
                intBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, int2bytes(value, buf.order())));
View Full Code Here

      IntBuffer pixelBuffer = pixmap.getPixels().asIntBuffer();
      int[] pixelsRGBA = new int[pixelBuffer.capacity()];
      pixelBuffer.get(pixelsRGBA);
      int[] pixelsARGBflipped = new int[pixelBuffer.capacity()];
      int pixel;
      if (pixelBuffer.order() == ByteOrder.BIG_ENDIAN) {
        for (int y = 0; y < pixmap.getHeight(); ++y) {
          for (int x = 0; x < pixmap.getWidth(); ++x) {
            pixel = pixelsRGBA[x + (y * pixmap.getWidth())];
            pixelsARGBflipped[x + ((pixmap.getHeight() - 1 - y) * pixmap.getWidth())] = ((pixel >> 8) & 0x00FFFFFF) | ((pixel << 24) & 0xFF000000);
          }
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.