Code example for LongBuffer

Methods: hasRemaining, rewind

0
    return numInserted;
  } 
 
  public void add(long value) throws IOException
  { 
    if (! endBuffer.hasRemaining()) {
      endBuffer.rewind();
      flattener.write(StupidResourceHolder.create(endBuffer));
      endBuffer = LongBuffer.allocate(sizePer);
      endBuffer.mark();
    } 
 
    endBuffer.put(value);
    ++numInserted;
  } 
 
  public void closeAndConsolidate(OutputSupplier<? extends OutputStream> consolidatedOut) throws IOException
  { 
    endBuffer.limit(endBuffer.position());
    endBuffer.rewind();
    flattener.write(StupidResourceHolder.create(endBuffer));