Package java.nio

Examples of java.nio.ShortBuffer.limit()


            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        ShortBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubMutableShortBufferArrayImpl(this, copy);
    }

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


            return this;
        }
        subArrayCheck(newOffset, newLength);
        ShortBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubMutableShortBufferArrayImpl(this, copy);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
    private class ArrayIteratorImpl implements ArrayIterator.OfShort {
View Full Code Here

        // readonly's contents should be the same as buf
        ShortBuffer 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);
    }

    public void testDuplicate() {
View Full Code Here

        // duplicate's contents should be the same as buf
        ShortBuffer 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 short get()
View Full Code Here

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

        } catch (NullPointerException e) {
        }

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

    if (isVertexArray) {
      if (indices.getNumIndices() > 0) {
        ShortBuffer buffer = indices.getBuffer();
        int oldPosition = buffer.position();
        int oldLimit = buffer.limit();
        buffer.position(offset);
        buffer.limit(offset + count);
        Gdx.gl10.glDrawElements(primitiveType, count, GL10.GL_UNSIGNED_SHORT, buffer);
        buffer.position(oldPosition);
        buffer.limit(oldLimit);
View Full Code Here

      if (indices.getNumIndices() > 0) {
        ShortBuffer buffer = indices.getBuffer();
        int oldPosition = buffer.position();
        int oldLimit = buffer.limit();
        buffer.position(offset);
        buffer.limit(offset + count);
        Gdx.gl10.glDrawElements(primitiveType, count, GL10.GL_UNSIGNED_SHORT, buffer);
        buffer.position(oldPosition);
        buffer.limit(oldLimit);
      } else
        Gdx.gl10.glDrawArrays(primitiveType, offset, count);
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.