Java Code Examples for java.io.UnsupportedEncodingException#initCause()
The following examples show how to use
java.io.UnsupportedEncodingException#initCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ByteString.java From play-store-api with GNU General Public License v3.0 | 5 votes |
/** * Constructs a new {@code String} by decoding the bytes using the * specified charset. * * @param charsetName encode using this charset * @return new string * @throws UnsupportedEncodingException if charset isn't recognized */ public final String toString(String charsetName) throws UnsupportedEncodingException { try { return toString(Charset.forName(charsetName)); } catch (UnsupportedCharsetException e) { UnsupportedEncodingException exception = new UnsupportedEncodingException(charsetName); exception.initCause(e); throw exception; } }
Example 2
Source File: Charset.java From j2objc with Apache License 2.0 | 5 votes |
/** * Equivalent to {@code forName} but only throws {@code UnsupportedEncodingException}, * which is all pre-nio code claims to throw. * * @hide internal use only */ public static Charset forNameUEE(String charsetName) throws UnsupportedEncodingException { try { return Charset.forName(charsetName); } catch (Exception cause) { UnsupportedEncodingException ex = new UnsupportedEncodingException(charsetName); ex.initCause(cause); throw ex; } }