/** * Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new * byte array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#ISO_8859_1} 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[] getBytesIso8859_1(final String string) { return getBytes(string, Charsets.ISO_8859_1); }
/** * Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @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); }
/** * Encodes the given string into a sequence of bytes using the UTF-16 charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#UTF_16} 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[] getBytesUtf16(final String string) { return getBytes(string, Charsets.UTF_16); }
/** * Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#US_ASCII} 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[] getBytesUsAscii(final String string) { return getBytes(string, Charsets.US_ASCII); }
/** * Encodes the given string into a sequence of bytes using the UTF-16LE charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string 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 * @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[] getBytesUtf16Le(final String string) { return getBytes(string, Charsets.UTF_16LE); }
/** * Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#UTF_8} 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[] getBytesUtf8(final String string) { return getBytes(string, Charsets.UTF_8); }
/** * Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#US_ASCII} 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[] getBytesUsAscii(final String string) { return getBytes(string, Charsets.US_ASCII); }
/** * Encodes the given string into a sequence of bytes using the UTF-16LE charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string 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 * @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[] getBytesUtf16Le(final String string) { return getBytes(string, Charsets.UTF_16LE); }
/** * Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#US_ASCII} 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[] getBytesUsAscii(final String string) { return getBytes(string, Charsets.US_ASCII); }
/** * Encodes the given string into a sequence of bytes using the UTF-16 charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#UTF_16} 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[] getBytesUtf16(final String string) { return getBytes(string, Charsets.UTF_16); }
/** * Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new * byte array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#ISO_8859_1} 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[] getBytesIso8859_1(final String string) { return getBytes(string, Charsets.ISO_8859_1); }
/** * Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new * byte array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#ISO_8859_1} 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[] getBytesIso8859_1(final String string) { return getBytes(string, Charsets.ISO_8859_1); }
/** * Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @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); }
/** * Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#UTF_8} 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[] getBytesUtf8(final String string) { return getBytes(string, Charsets.UTF_8); }
/** * Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#UTF_8} 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[] getBytesUtf8(final String string) { return getBytes(string, Charsets.UTF_8); }
/** * Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string was <code>null</code> * @throws NullPointerException * Thrown if {@link Charsets#US_ASCII} 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[] getBytesUsAscii(final String string) { return getBytes(string, Charsets.US_ASCII); }
/** * Encodes the given string into a sequence of bytes using the UTF-16LE charset, storing the result into a new byte * array. * * @param string * the String to encode, may be <code>null</code> * @return encoded bytes, or <code>null</code> if the input string 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 * @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[] getBytesUtf16Le(final String string) { return getBytes(string, Charsets.UTF_16LE); }
/** * Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new * byte array. * * @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#ISO_8859_1} 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[] getBytesIso8859_1(final String string) { return getBytes(string, Charsets.ISO_8859_1); }
/** * Encodes the given string into a sequence of bytes using the UTF-16 charset, storing the result into a new byte * array. * * @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_16} 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[] getBytesUtf16(final String string) { return getBytes(string, Charsets.UTF_16); }
/** * Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte * array. * * @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); }