public void write(char cbuf[],int off,int len){
  if ((off < 0) || (off > cbuf.length) || (len < 0)|| ((off + len) > cbuf.length)|| ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return;
  }
  buf.append(cbuf,off,len);
}

public void write ( char cbuf [ ] , int off , int len ) { if ( ( off < 0 ) || ( off > cbuf . length ) || ( len < 0 ) || ( ( off + len ) > cbuf . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } buf . append ( cbuf , off , len ) ; }
write a portion of an array of characters .
