/** * Constructs a new <code>String</code> by decoding the specified array of bytes using the * US-ASCII charset. * * @param bytes The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the given * charset. * @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught, * which should never happen since the charset is required. */ public static String newStringUsAscii(byte[] bytes) { return StringUtils.newString(bytes, CharEncoding.US_ASCII); }
/** * Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8 * charset. * * @param bytes The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the given * charset. * @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught, * which should never happen since the charset is required. */ public static String newStringUtf8(byte[] bytes) { return StringUtils.newString(bytes, CharEncoding.UTF_8); }
/** * Constructs a new <code>String</code> by decoding the specified array of bytes using the * ISO-8859-1 charset. * * @param bytes The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the given * charset. * @throws IllegalStateException Thrown when a {@link UnsupportedEncodingException} is caught, * which should never happen since the charset is required. */ public static String newStringIso8859_1(byte[] bytes) { return StringUtils.newString(bytes, CharEncoding.ISO_8859_1); }