List of usage examples for org.apache.commons.codec Charsets UTF_16BE
Charset UTF_16BE
To view the source code for org.apache.commons.codec Charsets UTF_16BE.
Click Source Link
From source file:com.anrisoftware.prefdialog.csvimportdialog.panelproperties.panelproperties.CsvPanelPropertiesModule.java
@SuppressWarnings("deprecation") @Provides/*from w w w . jav a 2 s .c o m*/ @Singleton @Named("charsetDefaults") Collection<Charset> getCharsetDefaults() { List<Charset> list = new ArrayList<Charset>(); list.add(Charsets.UTF_8); list.add(Charsets.UTF_16); list.add(Charsets.UTF_16BE); list.add(Charsets.UTF_16LE); list.add(Charsets.US_ASCII); list.add(Charsets.ISO_8859_1); return list; }
From source file:com.yhspy.zbartest.StringUtils.java
/** * Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte * array.//www .ja v a 2 s.c o m * * @param string * the String to encode, may be {@code null} * @return encoded bytes, or {@code null} if the input string was {@code null} * @throws NullPointerException * Thrown if {@link Charsets#UTF_16BE} is not initialized, which should never happen since it is * required by the Java platform specification. * @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException * @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a> * @see #getBytesUnchecked(String, String) */ public static byte[] getBytesUtf16Be(final String string) { return getBytes(string, Charsets.UTF_16BE); }
From source file:com.yhspy.zbartest.StringUtils.java
/** * Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16BE charset. * * @param bytes/*from ww w . j av a 2 s. co m*/ * The bytes to be decoded into characters * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16BE charset, * or {@code null} if the input byte array was {@code null}. * @throws NullPointerException * Thrown if {@link Charsets#UTF_16BE} is not initialized, which should never happen since it is * required by the Java platform specification. * @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException */ public static String newStringUtf16Be(final byte[] bytes) { return new String(bytes, Charsets.UTF_16BE); }