public final void sendTo(ByteBuffer out){
  finishWriting();
  if (out.remaining() < size()) {
    throw new BufferOverflowException();
  }
  if (this.chunks != null) {
    for (    ByteBuffer bb : this.chunks) {
      int bytesToWrite=bb.remaining();
      if (bytesToWrite > 0) {
        out.put(bb);
        this.size-=bytesToWrite;
      }
    }
  }
{
    ByteBuffer bb=this.buffer;
    int bytesToWrite=bb.remaining();
    if (bytesToWrite > 0) {
      out.put(bb);
      this.size-=bytesToWrite;
    }
  }
}

public final void sendTo ( ByteBuffer out ) { finishWriting ( ) ; if ( out . remaining ( ) < size ( ) ) { throw new BufferOverflowException ( ) ; } if ( this . chunks != null ) { for ( ByteBuffer bb : this . chunks ) { int bytesToWrite = bb . remaining ( ) ; if ( bytesToWrite > 0 ) { out . put ( bb ) ; this . size -= bytesToWrite ; } } } { ByteBuffer bb = this . buffer ; int bytesToWrite = bb . remaining ( ) ; if ( bytesToWrite > 0 ) { out . put ( bb ) ; this . size -= bytesToWrite ; } } }
write the contents of this stream to the byte buffer .
