Code example for Charset

Methods: decode

0
  public String getResponseAsString() {
    if (responseString == null) {
      Charset charset = encodingToCharset.get(encoding);
      if (charset == null) {
        charset = Charset.forName(encoding);
        encodingToCharset.put(encoding, charset);
      } 
      responseString = charset.decode(ByteBuffer.wrap(responseBytes)).toString();
 
      // Strip BOM if present 
      if (responseString.length() > 0 && responseString.codePointAt(0) == 0xFEFF) {
        responseString = responseString.substring(1);
      } 
    } 
    return responseString;
  } 
 
  /** 
   * @return All headers for this object. 
   */ 
  public Map<String, List<String>> getHeaders() {