545556575859606162
*/ public void setCharset(String charset) { if(charset==null || charset.trim().length()==0) return; if(Charset.isSupported(charset)==false) { throw new UnsupportedCharsetException(charset); } this.charset = charset; }
121122123124125126127
private Charset lookupCharset(final String csn) throws UnsupportedCharsetException { if (Charset.isSupported(csn)) { return Charset.forName(csn); } throw new UnsupportedCharsetException(csn); }
406407408409410411412
if (Charset.isSupported(charset)) { Charset.forName(charset); return; } } throw new UnsupportedCharsetException(charset); }
389390391392393394395
276277278279280281282
949596979899100101
private static String encodeComponent(String s, String charset) { try { return URLEncoder.encode(s, charset).replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charset); } }
139140141142143144145146
} try { return URLDecoder.decode(s, charset); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charset); } }
542543544545546547548549
} try { return new String(data, charsetName); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charsetName); } }
7071727374757677787980
} try { this.content = string.getBytes(charset.name()); } catch (final UnsupportedEncodingException ex) { // should never happen throw new UnsupportedCharsetException(charset.name()); } if (contentType != null) { setContentType(contentType.toString()); } }
80818283848586878889
byte[] ba = readBody(); String enc = request.getCharacterEncoding(); try { this.strBody = enc!=null ? new String(ba, enc) : new String(ba); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(enc); } } return strBody; }