Package java.nio

Examples of java.nio.IntBuffer.position()


        IntBuffer readonly = buf.asReadOnlyBuffer();
        IntBuffer duplicate = buf.duplicate();
        assertTrue(buf.hashCode() == readonly.hashCode());

        assertTrue(buf.capacity() > 5);
        duplicate.position(buf.capacity() / 2);
        assertTrue(buf.hashCode() != duplicate.hashCode());
    }

    public  void testIsDirect() {
        assertFalse(buf.isDirect());
View Full Code Here


        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();
            fail("Should throw Exception"); //$NON-NLS-1$
View Full Code Here

            fail("Should throw NPE"); //$NON-NLS-1$
        } catch (NullPointerException e) {
        }

        IntBuffer buf = IntBuffer.wrap(array, 2, 16);
        assertEquals(buf.position(), 2);
        assertEquals(buf.limit(), 18);
        assertEquals(buf.capacity(), 20);
    }
}
View Full Code Here

              PixelType pt = channel.getPixelType();
              switch (pt) {
              case UINT:
                {
                  IntBuffer chBuf = (IntBuffer) getChannelBuffer(name);
                  chBuf.position(((y - ymin) / sy) * numElem);
                  chBuf.put((IntBuffer) inBuf.asIntBuffer().limit(numElem));
                  break;
                }

              case HALF:
View Full Code Here

                }

              case HALF:
                {
                  ShortBuffer chBuf = (ShortBuffer) getChannelBuffer(name);
                  chBuf.position(((y - ymin) / sy) * numElem);
                  chBuf.put((ShortBuffer) inBuf.asShortBuffer().limit(numElem));
                  break;
                }

              case FLOAT:
View Full Code Here

                }

              case FLOAT:
                {
                  FloatBuffer chBuf = (FloatBuffer) getChannelBuffer(name);
                  chBuf.position(((y - ymin) / sy) * numElem);
                  chBuf.put((FloatBuffer) inBuf.asFloatBuffer().limit(numElem));
                  break;
                }

              } // switch (channel.getPixelType())
View Full Code Here

        // read our int data
        IntBuffer iin = in.asIntBuffer();
        _max = iin.get();
        iin.get(_counts);
        in.position(iin.position() * INT_SIZE);

        // read our long data
        LongBuffer lin = in.asLongBuffer();
        _snapTotal = (_total = lin.get());
        in.position(iin.position() * INT_SIZE + lin.position() * 2 * INT_SIZE);
 
View Full Code Here

        in.position(iin.position() * INT_SIZE);

        // read our long data
        LongBuffer lin = in.asLongBuffer();
        _snapTotal = (_total = lin.get());
        in.position(iin.position() * INT_SIZE + lin.position() * 2 * INT_SIZE);

        // read our min value (which was added afterwards and must do some jockeying to maintain
        // backwards compatibility)
        if (in.position() == in.limit()) {
            _min = 0; // legacy
View Full Code Here

        // write our int data
        IntBuffer iout = out.asIntBuffer();
        iout.put(_max);
        iout.put(_counts);
        out.position(iout.position() * INT_SIZE);

        // write our long data
        LongBuffer lout = out.asLongBuffer();
        lout.put(_total);
        out.position(iout.position() * INT_SIZE + lout.position() * 2 * INT_SIZE);
 
View Full Code Here

        out.position(iout.position() * INT_SIZE);

        // write our long data
        LongBuffer lout = out.asLongBuffer();
        lout.put(_total);
        out.position(iout.position() * INT_SIZE + lout.position() * 2 * INT_SIZE);

        // write our min value (added later so we can't write it above like we wish we could)
        out.asIntBuffer().put(_min);

        return data;
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.