@Override public void write(byte[] buf,int offset,int length,boolean isEnd) throws IOException {
  while (offset < length) {
    TempBuffer tail=_tail;
    if (tail == null || tail.buffer().length <= tail.length()) {
      addBuffer(TempBuffer.create());
      tail=_tail;
    }
    int tailLength=tail.length();
    byte[] tailBuffer=tail.buffer();
    int sublen=tailBuffer.length - tailLength;
    if (length - offset < sublen) {
      sublen=length - offset;
    }
    System.arraycopy(buf,offset,tailBuffer,tailLength,sublen);
    offset+=sublen;
    tail.length(tailLength + sublen);
  }
}

@ Override public void write ( byte [ ] buf , int offset , int length , boolean isEnd ) throws IOException { while ( offset < length ) { TempBuffer tail = _tail ; if ( tail == null || tail . buffer ( ) . length <= tail . length ( ) ) { addBuffer ( TempBuffer . create ( ) ) ; tail = _tail ; } int tailLength = tail . length ( ) ; byte [ ] tailBuffer = tail . buffer ( ) ; int sublen = tailBuffer . length - tailLength ; if ( length - offset < sublen ) { sublen = length - offset ; } System . arraycopy ( buf , offset , tailBuffer , tailLength , sublen ) ; offset += sublen ; tail . length ( tailLength + sublen ) ; } }
writes a buffer to the underlying stream .
