Package java.nio

Examples of java.nio.LongBuffer.limit()


        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 long get()
View Full Code Here


        LongBuffer 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) {
        }

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

    if (buffer == null) throw new GdxRuntimeException("dst must be a ByteBuffer or LongBuffer");

    int oldPosition = buffer.position();
    buffer.put(src, srcOffset, numElements);
    buffer.position(oldPosition);
    buffer.limit(oldPosition + numElements);
  }

  /** Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The {@link Buffer} instance's
   * {@link Buffer#position()} is used to define the offset into the Buffer itself. The position will stay the same, the limit
   * will be set to position + numElements. <b>The Buffer must be a direct Buffer with native byte order. No error checking is
View Full Code Here

    if (buffer == null) throw new GdxRuntimeException("dst must be a ByteBuffer or LongBuffer");

    int oldPosition = buffer.position();
    buffer.put(src, srcOffset, numElements);
    buffer.position(oldPosition);
    buffer.limit(oldPosition + numElements);
  }

  /** Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The {@link Buffer} instance's
   * {@link Buffer#position()} is used to define the offset into the Buffer itself. The position will stay the same, the limit
   * will be set to position + numElements. <b>The Buffer must be a direct Buffer with native byte order. No error checking is
View Full Code Here

      long revNum) {
    LongBuffer lb = pof.getLongBuffer();
    int low = lookupTermIndex(termValue1);
        // because of concurrent insertions, target may have moved ahead; that's why we continue to check the lower bound
        ArrayList<Scanner> scanners = new ArrayList<Scanner>();
        int lbLimit = lb.limit() / 8;
        while(true) {
          long pair = lb.get(low++);
          long termId = topUInt(pair);
          int page = (int)bottomUInt(pair);
          boolean isRanged = (page & RANGE_MASK) == RANGE_MASK;
View Full Code Here

        }
    }

    private void assertEquals(HashCode h1, MurmurHash3.Hash128 h2) {
        final LongBuffer longs = ByteBuffer.wrap(h1.asBytes()).order(ByteOrder.LITTLE_ENDIAN).asLongBuffer();
        assertEquals(2, longs.limit());
        assertEquals(h1.asLong(), h2.h1);
        assertEquals(longs.get(), h2.h1);
        assertEquals(longs.get(), h2.h2);
    }
View Full Code Here

     */
    @Test
    public void testAllocateLongBuffer()
    {
        LongBuffer buffer = BufferUtils.allocateLongBuffer();
        assertEquals(1, buffer.limit());
    }

    /**
     * Tests the {@link BufferUtils#slice(ByteBuffer, int, int)} method.
     */
 
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.