code: public char[] toCharArray()
      {
          // check if there is a cached single charbuffer
          if (firstChunk == lastChunk && firstChunk instanceof CharBufferChunk
                  && allocBuffer.charsUsed() == 0
                  && ((CharBufferChunk) firstChunk).isSingleBuffer())
          {
              return ((CharBufferChunk) firstChunk).buffer;
          }
  
          int initialReaderCount = readerCount;
          char[] buf = readAsCharArray();
          if (initialReaderCount == 0)
          {
              // if there are no readers, the result can be cached
              reset();
              if (buf.length > 0)
              {
                  addChunk(new CharBufferChunk(-1, buf, 0, buf.length));
              }
          }
          return buf;
      }
docs: Reads the buffer to a char[].
  
  Caches the result if there aren't any readers.
  
  @return the chars