@Override public boolean hasNext() { if (isEmpty()) { return false; } if (hasNextWord) { return true; } return currRow < (words.capacity() - 1); }
public long getTotalOffHeapMemUsed() { ValueToDictId valueToDictId = _valueToDict; long size = 0; for (IntBuffer iBuf : valueToDictId._iBufList) { size = size + iBuf.capacity() * Integer.BYTES; } return size; }
/** Returns a string represents of the state of this int buffer. * * @return a string represents of the state of this int buffer. * @since Android 1.0 */ public String toString () { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()); sb.append(", status: capacity="); //$NON-NLS-1$ sb.append(capacity()); sb.append(" position="); //$NON-NLS-1$ sb.append(position()); sb.append(" limit="); //$NON-NLS-1$ sb.append(limit()); return sb.toString(); } }
/** Returns a string represents of the state of this int buffer. * * @return a string represents of the state of this int buffer. * @since Android 1.0 */ public String toString () { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()); sb.append(", status: capacity="); //$NON-NLS-1$ sb.append(capacity()); sb.append(" position="); //$NON-NLS-1$ sb.append(position()); sb.append(" limit="); //$NON-NLS-1$ sb.append(limit()); return sb.toString(); } }
public byte[] toBytes() { if (words == null) { return new byte[]{}; } ByteBuffer buf = ByteBuffer.allocate(words.capacity() * Integer.BYTES); buf.asIntBuffer().put(words.asReadOnlyBuffer()); return buf.array(); }
private IntBuffer expand() { final ValueToDictId valueToDictId = _valueToDict; List<IntBuffer> iBufList = valueToDictId.getIBufList(); final int numBuffers = iBufList.size(); if (numBuffers == 0) { return expand(_initialRowCount, 1); } final int lastCapacity = iBufList.get(numBuffers - 1).capacity(); int expansionMultiple = EXPANSION_MULTIPLES[EXPANSION_MULTIPLES.length - 1]; if (numBuffers < EXPANSION_MULTIPLES.length) { expansionMultiple = EXPANSION_MULTIPLES[numBuffers]; } int prevNumRows = lastCapacity / NUM_COLUMNS; return expand(prevNumRows, expansionMultiple); }
final List<IntBuffer> iBufList = valueToDictId.getIBufList(); for (IntBuffer iBuf : iBufList) { final int modulo = iBuf.capacity() / NUM_COLUMNS; final int offsetInBuf = (hashVal % modulo) * NUM_COLUMNS; for (int i = offsetInBuf; i < offsetInBuf + NUM_COLUMNS; i++) {
void ensureCapacity(int size) { while (buffer.remaining() < size) { IntBuffer newB = allocateDirect(buffer.capacity() * 2); buffer.flip(); newB.put(buffer); buffer = newB; } }
public static IntBuffer ensureLargeEnough(IntBuffer buffer, int required) { if (buffer != null) { buffer.limit(buffer.capacity()); } if (buffer == null || (buffer.remaining() < required)) { int position = (buffer != null ? buffer.position() : 0); IntBuffer newVerts = createIntBuffer(position + required); if (buffer != null) { buffer.flip(); newVerts.put(buffer); newVerts.position(position); } buffer = newVerts; } return buffer; }
_pinotDataBuffers.add(buffer); IntBuffer iBuf = buffer.toDirectByteBuffer(0L, bbSize).asIntBuffer(); for (int i = 0; i < iBuf.capacity(); i++) { iBuf.put(i, NULL_VALUE_INDEX);
final int modulo = iBuf.capacity() / NUM_COLUMNS; final int offsetInBuf = (hashVal % modulo) * NUM_COLUMNS; for (int i = offsetInBuf; i < offsetInBuf + NUM_COLUMNS; i++) { final int modulo = buf.capacity() / NUM_COLUMNS; final int offsetInBuf = (hashVal % modulo) * NUM_COLUMNS; boolean done = false;
private long createGlfwCursor(JmeCursor jmeCursor) { GLFWImage glfwImage = new GLFWImage(BufferUtils.createByteBuffer(GLFWImage.SIZEOF)); // TODO: currently animated cursors are not supported IntBuffer imageData = jmeCursor.getImagesData(); ByteBuffer buf = BufferUtils.createByteBuffer(imageData.capacity() * 4); buf.asIntBuffer().put(imageData); glfwImage.set(jmeCursor.getWidth(), jmeCursor.getHeight(), buf); return glfwCreateCursor(glfwImage, jmeCursor.getXHotSpot(), jmeCursor.getYHotSpot()); }
int[] arr = new int[b.capacity()]; b.rewind(); b.get(arr);
public void testGet_io() throws IOException { assertEquals(-1, ArbitraryInstances.get(InputStream.class).read()); assertEquals(-1, ArbitraryInstances.get(ByteArrayInputStream.class).read()); assertEquals(-1, ArbitraryInstances.get(Readable.class).read(CharBuffer.allocate(1))); assertEquals(-1, ArbitraryInstances.get(Reader.class).read()); assertEquals(-1, ArbitraryInstances.get(StringReader.class).read()); assertEquals(0, ArbitraryInstances.get(Buffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(CharBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(ByteBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(ShortBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(IntBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(LongBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(FloatBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(DoubleBuffer.class).capacity()); ArbitraryInstances.get(PrintStream.class).println("test"); ArbitraryInstances.get(PrintWriter.class).println("test"); assertNotNull(ArbitraryInstances.get(File.class)); assertFreshInstanceReturned( ByteArrayOutputStream.class, OutputStream.class, Writer.class, StringWriter.class, PrintStream.class, PrintWriter.class); assertEquals(ByteSource.empty(), ArbitraryInstances.get(ByteSource.class)); assertEquals(CharSource.empty(), ArbitraryInstances.get(CharSource.class)); assertNotNull(ArbitraryInstances.get(ByteSink.class)); assertNotNull(ArbitraryInstances.get(CharSink.class)); }