src/main/java/com/bah/lucene/buffer/ReusedBufferedIndexInput.java
protected final int flushBuffer(IndexOutput out, long numBytes) throws IOException {
    int toCopy = bufferLength - bufferPosition;
    if (toCopy > numBytes) {
      toCopy = (int) numBytes;
    }
    if (toCopy > 0) {
      out.writeBytes(buffer, bufferPosition, toCopy);
      bufferPosition += toCopy;
    }
    return toCopy;
  }
protected final int flushBuffer(IndexOutput out, long numBytes) throws IOException {
    int toCopy = bufferLength - bufferPosition;
    if (toCopy > numBytes) {
      toCopy = (int) numBytes;
    }
    if (toCopy > 0) {
      out.writeBytes(buffer, bufferPosition, toCopy);
      bufferPosition += toCopy;
    }
    return toCopy;
  }
Flushes the in-memory bufer to the given output, copying at most
<code>numBytes</code>.
<p>
<b>NOTE:</b> this method does not refill the buffer, however it does
advance the buffer position.

@return the number of bytes actually flushed from the in-memory buffer.