@Override public void write(byte[] buf,int offset,int length,boolean isEnd) throws IOException {
  if (_s == null) {
    return;
  }
  try {
    _needsFlush=true;
    while (length > 0) {
      _writeBuffer.clear();
      int sublen=Math.min(length,_writeBuffer.remaining());
      _writeBuffer.put(buf,offset,sublen);
      _writeBuffer.flip();
      _s.write(_writeBuffer);
      length-=sublen;
      offset+=sublen;
    }
    _totalWriteBytes+=length;
  }
 catch (  IOException e) {
    IOException exn=ClientDisconnectException.create(this + ":" + e,e);
    try {
      close();
    }
 catch (    IOException e1) {
    }
    throw exn;
  }
}

@ Override public void write ( byte [ ] buf , int offset , int length , boolean isEnd ) throws IOException { if ( _s == null ) { return ; } try { _needsFlush = true ; while ( length > 0 ) { _writeBuffer . clear ( ) ; int sublen = Math . min ( length , _writeBuffer . remaining ( ) ) ; _writeBuffer . put ( buf , offset , sublen ) ; _writeBuffer . flip ( ) ; _s . write ( _writeBuffer ) ; length -= sublen ; offset += sublen ; } _totalWriteBytes += length ; } catch ( IOException e ) { IOException exn = ClientDisconnectException . create ( this + ":" + e , e ) ; try { close ( ) ; } catch ( IOException e1 ) { } throw exn ; } }
writes bytes to the socket .
