code: public synchronized void write(String str, int off,
                                     int len) throws IOException {
  
          checkClosed();
  
          int strlen = str.length();
  
          if ((off < 0) || (off > strlen) || (len < 0) || ((off + len) > strlen)
                  || ((off + len) < 0)) {
              throw new IndexOutOfBoundsException();
          } else if (len == 0) {
              return;
          }
  
          int newcount = count + len;
  
          if (newcount > buf.length) {
              buf = copyOf(buf, Math.max(buf.length << 1, newcount));
          }
  
          str.getChars(off, off + len, buf, count);
  
          count = newcount;
      }
docs: Efficiently writes the designated portion of the designated string. <p>
  
  The operation occurs as if by calling
  <tt>str.getChars(off, off + len, buf, count)</tt>. <p>
  
  @param str the string from which to write
  @param off the start offset in the string.
  @param len the number of characters to write.
  @throws java.io.IOException if an I/O error occurs.
  In particular, an <tt>IOException</tt> may be thrown
  if this writer has been {@link #close() closed}.