本文整理匯總了Java中org.apache.commons.codec.Charsets.UTF_16LE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Charsets.UTF_16LE屬性的具體用法?Java Charsets.UTF_16LE怎麽用?Java Charsets.UTF_16LE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.codec.Charsets
的用法示例。
在下文中一共展示了Charsets.UTF_16LE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newStringUtf16Le
public static String newStringUtf16Le(byte[] bytes) {
return new String(bytes, Charsets.UTF_16LE);
}
示例2: newStringUtf16Le
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16LE 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 UTF-16LE charset,
* or {@code null} if the input byte array was {@code null}.
* @throws NullPointerException
* Thrown if {@link Charsets#UTF_16LE} 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 newStringUtf16Le(final byte[] bytes) {
return new String(bytes, Charsets.UTF_16LE);
}
示例3: newStringUtf16Le
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16LE 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 UTF-16LE charset,
* or <code>null</code> if the input byte array was <code>null</code>.
* @throws NullPointerException
* Thrown if {@link Charsets#UTF_16LE} 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 newStringUtf16Le(final byte[] bytes) {
return new String(bytes, Charsets.UTF_16LE);
}