| 881 | } |
| 882 | |
| 883 | private Charset getCharset(final String encoding) |
| 884 | throws UnsupportedEncodingException { |
| 885 | Charset charset = lastCharset; |
| 886 | if (charset == null || !encoding.equalsIgnoreCase(charset.name())) { |
| 887 | try { |
| 888 | charset = Charset.forName(encoding); |
| 889 | } catch (IllegalCharsetNameException e) { |
| 890 | throw (UnsupportedEncodingException) (new UnsupportedEncodingException( |
| 891 | encoding).initCause(e)); |
| 892 | } catch (UnsupportedCharsetException e) { |
| 893 | throw (UnsupportedEncodingException) (new UnsupportedEncodingException( |
| 894 | encoding).initCause(e)); |
| 895 | } |
| 896 | lastCharset = charset; |
| 897 | } |
| 898 | return charset; |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * Copies the specified characters in this string to the character array |