/** * @return the content as a string, using the "Content-Type" header to detect the encoding * or defaulting to UTF-8 if the encoding could not be detected. * @see #getContentAsString(String) */ public String getContentAsString() { String encoding = this.encoding; if (encoding == null) return getContentAsString(StandardCharsets.UTF_8); return getContentAsString(encoding); }
/** * @param encoding the encoding of the content bytes * @return the content as a string, with the specified encoding * @see #getContentAsString() */ public String getContentAsString(String encoding) { try { return new String(getContent(), encoding); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(encoding); } } }
@Override public void onContent(Response response, ByteBuffer content) { if(responseContentStartedTick == 0L) { responseContentStartedTick = getTick(); } super.onContent(response, content); }
/** * @param encoding the encoding of the content bytes * @return the content as a string, with the specified encoding * @see #getContentAsString() */ public String getContentAsString(String encoding) { try { return new String(getContent(), encoding); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(encoding); } } }
/** * @return the content as a string, using the "Content-Type" header to detect the encoding * or defaulting to UTF-8 if the encoding could not be detected. * @see #getContentAsString(String) */ public String getContentAsString() { String encoding = this.encoding; if (encoding == null) encoding = "UTF-8"; return getContentAsString(encoding); }
/** * @return the content as a string, using the "Content-Type" header to detect the encoding * or defaulting to UTF-8 if the encoding could not be detected. * @see #getContentAsString(String) */ public String getContentAsString() { String encoding = this.encoding; if (encoding == null) encoding = "UTF-8"; return getContentAsString(encoding); }