public class CharsetByteTranslator extends ByteTranslator
In the adapter configuration file this class is aliased as charset-byte-translator which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
CharsetByteTranslator()
Default charset encoding is UTF-8.
|
CharsetByteTranslator(java.lang.String charset) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCharsetEncoding() |
void |
setCharsetEncoding(java.lang.String c) |
java.lang.String |
translate(byte[] bytes)
Translate a byte array into a String.
|
byte[] |
translate(java.lang.String s)
Translate a string into a byte array.
|
public CharsetByteTranslator()
public CharsetByteTranslator(java.lang.String charset)
public byte[] translate(java.lang.String s) throws java.io.UnsupportedEncodingException
ByteTranslator
translate
in class ByteTranslator
s
- the string.java.io.UnsupportedEncodingException
ByteTranslator.translate(java.lang.String)
public java.lang.String translate(byte[] bytes) throws java.io.UnsupportedEncodingException
ByteTranslator
translate
in class ByteTranslator
bytes
- the byte array.java.io.UnsupportedEncodingException
ByteTranslator.translate(byte[])
public java.lang.String getCharsetEncoding()
public void setCharsetEncoding(java.lang.String c)
c
- the charsetEncoding to set