Package java.nio

Examples of java.nio.LongBuffer.position()


  }

  private static LongBuffer doNoCopyWrap(LongBuffer buffer) {
    LongBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.limit(buffer.limit());
    direct_buffer.position(buffer.position());
    return direct_buffer;
  }

  private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) {
    DoubleBuffer direct_buffer = lookupBuffer(buffer);
View Full Code Here


            inflights.put(txnID, val);
          }
        }
      } catch (BufferUnderflowException ex) {
        LOG.debug("Reached end of inflights buffer. Long buffer position ="
                + String.valueOf(longBuffer.position()));
      }
      return  inflights;
    }

    public int getSize() {
View Full Code Here

            inflights.put(txnID, val);
          }
        }
      } catch (BufferUnderflowException ex) {
        LOG.debug("Reached end of inflights buffer. Long buffer position ="
                + String.valueOf(longBuffer.position()));
      }
      return  inflights;
    }

    public int getSize() {
View Full Code Here

            inflights.put(txnID, val);
          }
        }
      } catch (BufferUnderflowException ex) {
        LOG.debug("Reached end of inflights buffer. Long buffer position ="
                + String.valueOf(longBuffer.position()));
      }
      return  inflights;
    }

    public int getSize() {
View Full Code Here

            inflights.put(txnID, val);
          }
        }
      } catch (BufferUnderflowException ex) {
        LOG.debug("Reached end of inflights buffer. Long buffer position ="
                + String.valueOf(longBuffer.position()));
      }
      return  inflights;
    }

    public int getSize() {
View Full Code Here

            inflights.put(txnID, val);
          }
        }
      } catch (BufferUnderflowException ex) {
        LOG.debug("Reached end of inflights buffer. Long buffer position ="
                + String.valueOf(longBuffer.position()));
      }
      return  inflights;
    }

    public int getSize() {
View Full Code Here

                  public ResourceHolder<LongBuffer> next()
                  {
                    LongBuffer retVal = myBuffer.asReadOnlyBuffer();

                    if (chunkFactor < myBuffer.remaining()) {
                      retVal.limit(retVal.position() + chunkFactor);
                    }
                    myBuffer.position(myBuffer.position() + retVal.remaining());

                    return StupidResourceHolder.create(retVal);
                  }
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 10).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray2() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5, (long) 5));
        assertEquals(10, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4, 5, 5}, notBackedByArray.toArray());
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.