Package java.nio

Examples of java.nio.FloatBuffer.limit()


    @Override
    public MutableFloatArray length(int length) {
        int offset = elements.position();
        subArrayCheck(offset, length);
        FloatBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubBoundedFloatBufferArrayImpl(this, copy);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here


        int newOffset = offset + fromIndex;
        int newLength = toIndex - fromIndex;
        subArrayCheck(newOffset, newLength);
        FloatBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubBoundedFloatBufferArrayImpl(this, copy);
    }

    /**
     * Tells whether or not the array's content is resident in physical memory.
View Full Code Here

            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        FloatBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new FloatBufferArrayImpl(copy, characteristics, false);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here

        // readonly's contents should be the same as buf
        FloatBuffer readonly = buf.asReadOnlyBuffer();
        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
View Full Code Here

        assertTrue(other.compareTo(buf) < 0);
        other.position(2);
        assertTrue(buf.compareTo(other) < 0);
        assertTrue(other.compareTo(buf) > 0);
        buf.position(2);
        other.limit(5);
        assertTrue(buf.compareTo(other) > 0);
        assertTrue(other.compareTo(buf) < 0);
       
        FloatBuffer fbuffer1 = FloatBuffer.wrap(new float[] { Float.NaN });
        FloatBuffer fbuffer2 = FloatBuffer.wrap(new float[] { Float.NaN });
View Full Code Here

        // duplicate's contents should be the same as buf
        FloatBuffer duplicate = buf.duplicate();
        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);
View Full Code Here

        buf.limit(buf.capacity()).position(0);
        readonly.limit(readonly.capacity()).position(1);
        assertFalse(buf.equals(readonly));

        buf.limit(buf.capacity() - 1).position(0);
        duplicate.limit(duplicate.capacity()).position(0);
        assertFalse(buf.equals(duplicate));
    }

    /*
     * Class under test for float get()
View Full Code Here

        FloatBuffer 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$
        } catch (InvalidMarkException e) {
View Full Code Here

        } catch (NullPointerException e) {
        }

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

    public void updateGeometry() {
        final int numPairs = _tessSteps + 1;
        final int totalVerts = _tessRings * numPairs * 2;

        FloatBuffer crdBuf = getMeshData().getVertexBuffer();
        if (crdBuf == null || totalVerts != crdBuf.limit() / 3) { // allocate new buffers
            getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(totalVerts * 3));
            getMeshData().setNormalBuffer(BufferUtils.createFloatBuffer(totalVerts * 3));
            getMeshData().setTextureCoords(new FloatBufferData(BufferUtils.createFloatBuffer(totalVerts * 2), 2), 0);
            crdBuf = getMeshData().getVertexBuffer();
        }
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.