code: public int read(char cbuf[], int off, int len) throws IOException {
          synchronized (lock) {
              ensureOpen();
              try {
                  if (len <= 0) {
                      if (len < 0) {
                          throw new IndexOutOfBoundsException();
                      } else if ((off < 0) || (off > cbuf.length)) {
                          throw new IndexOutOfBoundsException();
                      }
                      return 0;
                  }
                  int avail = buf.length - pos;
                  if (avail > 0) {
                      if (len < avail)
                          avail = len;
                      System.arraycopy(buf, pos, cbuf, off, avail);
                      pos += avail;
                      off += avail;
                      len -= avail;
                  }
                  if (len > 0) {
                      len = super.read(cbuf, off, len);
                      if (len == -1) {
                          return (avail == 0) ? -1 : avail;
                      }
                      return avail + len;
                  }
                  return avail;
              } catch (ArrayIndexOutOfBoundsException e) {
                  throw new IndexOutOfBoundsException();
              }
          }
      }
docs: Reads characters into a portion of an array.
  
  @param      cbuf  Destination buffer
  @param      off   Offset at which to start writing characters
  @param      len   Maximum number of characters to read
  
  @return     The number of characters read, or -1 if the end of the
  stream has been reached
  
  @exception  IOException  If an I/O error occurs