157158159160161162163164
final String csname = charset != null ? charset.name() : Consts.ASCII.name(); try { this.content = text.getBytes(csname); } catch (final UnsupportedEncodingException ex) { // Should never happen throw new UnsupportedCharsetException(csname); } }
111112113114115116117118119
{ return new String(getContent(), encoding); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(encoding); } } }
660661662663664665666667
{ return URLEncoder.encode(value, encoding); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(encoding); } }
691692693694695696697698
{ return URLDecoder.decode(value, charset); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(charset); } }
148149150151152153154155
{ return new String(getContent(), encoding); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(encoding); } }
645646647648649650651652
676677678679680681682683
124125126127128129130131
private static String encodeComponent(String s, Charset charset) { try { return URLEncoder.encode(s, charset.name()).replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charset.name()); } }
453454455456457458459
if (Charset.isSupported(charset)) { Charset.forName(charset); return; } } throw new UnsupportedCharsetException(charset); }
289290291292293294295