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;
          MultipartCharBufferChunk chunk = readToSingleChunk();
          if (initialReaderCount == 0) {
              // if there are no readers, the result can be cached
              reset();
              if (chunk != null) {
                  addChunk(chunk);
              }
          }
          if(chunk != null) {
              return chunk.buffer;
          } else {
              return new char[0];
          }
      }
docs: Reads the buffer to a char[].
  
  Caches the result if there aren't any readers.
  
  @return the chars