@Override public void write(byte[] buf,int offset,int length) throws IOException {
  final byte[] buffer=_writeBuffer;
  final int bufferLength=buffer.length;
  StreamImpl source=_source;
  while (true) {
    final int writeLength=_writeLength;
    if (writeLength == 0 && bufferLength <= length) {
      if (source != null) {
        source.write(buf,offset,length,false);
        _position+=length;
        return;
      }
    }
    final int sublen=Math.min(length,bufferLength - writeLength);
    System.arraycopy(buf,offset,buffer,writeLength,sublen);
    if (length == sublen) {
      _writeLength=writeLength + length;
      if (_implicitFlush) {
        flush();
      }
      return;
    }
    if (source == null) {
      return;
    }
    source.write(buffer,0,bufferLength,false);
    _position+=bufferLength;
    _writeLength=0;
    length-=sublen;
    offset+=sublen;
    if (bufferLength <= length) {
      source.write(buf,offset,length,false);
      _position+=length;
      return;
    }
  }
}

@ Override public void write ( byte [ ] buf , int offset , int length ) throws IOException { final byte [ ] buffer = _writeBuffer ; final int bufferLength = buffer . length ; StreamImpl source = _source ; while ( true ) { final int writeLength = _writeLength ; if ( writeLength == 0 && bufferLength <= length ) { if ( source != null ) { source . write ( buf , offset , length , false ) ; _position += length ; return ; } } final int sublen = Math . min ( length , bufferLength - writeLength ) ; System . arraycopy ( buf , offset , buffer , writeLength , sublen ) ; if ( length == sublen ) { _writeLength = writeLength + length ; if ( _implicitFlush ) { flush ( ) ; } return ; } if ( source == null ) { return ; } source . write ( buffer , 0 , bufferLength , false ) ; _position += bufferLength ; _writeLength = 0 ; length -= sublen ; offset += sublen ; if ( bufferLength <= length ) { source . write ( buf , offset , length , false ) ; _position += length ; return ; } } }
writes a byte array
