code: public String getResponseBodyAsString(int maxlen) throws IOException {
          if (maxlen < 0) throw new IllegalArgumentException("maxlen must be positive");
          byte[] rawdata = null;
          if (responseAvailable()) {
              rawdata = getResponseBody(maxlen);
          }
          if (rawdata != null) {
              return EncodingUtil.getString(rawdata, getResponseCharSet());
          } else {
              return null;
          }
      }
docs: Returns the response body of the HTTP method, if any, as a {@link String}.
  If response body is not available or cannot be read, returns <tt>null</tt>
  The string conversion on the data is done using the character encoding specified
  in <tt>Content-Type</tt> header. Buffers the response and this method can be
  called several times yielding the same result each time.</p>
  
  Note: This will cause the entire response body to be buffered in memory. This method is
  safe if the content length of the response is unknown, because the amount of memory used
  is limited.<p>
  
  If the response is large this method involves lots of array copying and many object
  allocations, which makes it unsuitable for high-performance / low-footprint applications.
  Those applications should use {@link #getResponseBodyAsStream()}.
  
  @param maxlen the maximum content length to accept (number of bytes). Note that,
  depending on the encoding, this is not equal to the number of characters.
  @return The response body or <code>null</code>.
  
  @throws IOException If an I/O (transport) problem occurs while obtaining the
  response body.