public final class Encoding extends Object
| Constructor and Description |
|---|
Encoding() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getBytes(String text)
|
static byte[] |
getBytes(String text,
String encoding)
Converts given
String with given encoding to byte array representation. |
static String |
getString(byte[] text)
|
static String |
getString(byte[] text,
String encoding)
Converts given byte array to
String with given encoding. |
static void |
checkEncoding(String encoding)
Checks whether given encoding (name) is supported.
|
public static final String DEFAULT
public static void checkEncoding(String encoding) throws IllegalArgumentException
encoding - encoding to checkIllegalArgumentException - possible exception if encoding is null or not supportedpublic static byte[] getBytes(String text, String encoding) throws IllegalArgumentException
String with given encoding to byte array representation.
It is recommended to check your encoding via checkEncoding(String).text - text to be convertedencoding - encoding of textIllegalArgumentException - possible exception if text is null or encoding is not supportedpublic static byte[] getBytes(String text)
text - text to be convertedIllegalArgumentException - possible exception if text is null or encoding is not supportedpublic static String getString(byte[] text, String encoding) throws IllegalArgumentException
String with given encoding.
It is recommended to check your encoding via checkEncoding(String).text - text bytes to be convertedencoding - encoding for outputIllegalArgumentException - possible exception if text bytes are null or encoding is not supportedpublic static String getString(byte[] text)
text - text bytes to be convertedIllegalArgumentException - possible exception if text bytes are null or encoding is not supportedCopyright © 2019. All rights reserved.