code: public void write(String str, int off, int len) throws IOException {
          synchronized (lock) {
              char cbuf[];
              if (len <= WRITE_BUFFER_SIZE) {
                  if (writeBuffer == null) {
                      writeBuffer = new char[WRITE_BUFFER_SIZE];
                  }
                  cbuf = writeBuffer;
              } else {    // Don't permanently allocate very large buffers.
                  cbuf = new char[len];
              }
              str.getChars(off, (off + len), cbuf, 0);
              write(cbuf, 0, len);
          }
      }
docs: Writes a portion of a string.
  
  @param  str
  A String
  
  @param  off
  Offset from which to start writing characters
  
  @param  len
  Number of characters to write
  
  @throws  IndexOutOfBoundsException
  If <tt>off</tt> is negative, or <tt>len</tt> is negative,
  or <tt>off+len</tt> is negative or greater than the length
  of the given string
  
  @throws  IOException
  If an I/O error occurs