606607608609610611612613614615616
public void setEncoding(String encoding) { if (encoding==null) { throw new NullPointerException("encoding cannot be null"); } else if (!Charset.isSupported(encoding)) { throw new UnsupportedCharsetException(encoding); } if (charSet==null || !charSet.equals(encoding)) { charSet = encoding; setDirty(true); }
6970717273747576
{ return URLEncoder.encode(value, charset.name()); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(charset.name()); } }
719720721722723724725726
{ return URLEncoder.encode(value, encoding); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(encoding); } }
750751752753754755756757
{ return URLDecoder.decode(value, charset); } catch (UnsupportedEncodingException x) { throw new UnsupportedCharsetException(charset); } }
118119120121122123124125126
{ return new String(getContent(), encoding); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(encoding); } } }
114115116117118119120121
private static String encodeComponent(String s, Charset charset) { // TODO: Optimize me. try { return URLEncoder.encode(s, charset.name()).replace("+", "%20"); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charset.name()); } }
422423424425426427428
if (Charset.isSupported(charset)) { Charset.forName(charset); return; } } throw new UnsupportedCharsetException(charset); }
379380381382383384385
605606607608609610611612
*/ public static ChannelBuffer copiedBuffer(ByteOrder endianness, String string, String charsetName) { try { return wrappedBuffer(endianness, string.getBytes(charsetName)); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charsetName); } }
177178179180181182183184
public String toString(int index, int length, String charsetName) { try { return new String(array, index, length, charsetName); } catch (UnsupportedEncodingException e) { throw new UnsupportedCharsetException(charsetName); } }