Search in sources :

Example 6 with HexStringByteTranslator

use of com.adaptris.util.text.HexStringByteTranslator in project interlok by adaptris.

the class HexToStringService method reformat.

@Override
public String reformat(String s, String msgCharset) throws Exception {
    ByteTranslator hexToBytes = new HexStringByteTranslator();
    ByteTranslator bytesToString = new CharsetByteTranslator(getCharacterEncoding());
    return bytesToString.translate(hexToBytes.translate(s));
}
Also used : ByteTranslator(com.adaptris.util.text.ByteTranslator) HexStringByteTranslator(com.adaptris.util.text.HexStringByteTranslator) CharsetByteTranslator(com.adaptris.util.text.CharsetByteTranslator) CharsetByteTranslator(com.adaptris.util.text.CharsetByteTranslator) HexStringByteTranslator(com.adaptris.util.text.HexStringByteTranslator)

Example 7 with HexStringByteTranslator

use of com.adaptris.util.text.HexStringByteTranslator in project interlok by adaptris.

the class MetadataHashingTest method testService_KnownHash.

@Test
public void testService_KnownHash() throws Exception {
    MetadataHashingService service = new MetadataHashingService(METADATA_KEY, "MD5", new HexStringByteTranslator());
    AdaptrisMessage msg = createMessage(null);
    execute(service, msg);
    assertEquals(METADATA_HASH_MD5, msg.getMetadataValue(METADATA_KEY));
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) HexStringByteTranslator(com.adaptris.util.text.HexStringByteTranslator) Test(org.junit.Test)

Aggregations

HexStringByteTranslator (com.adaptris.util.text.HexStringByteTranslator)7 Test (org.junit.Test)4 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 ByteTranslator (com.adaptris.util.text.ByteTranslator)3 CharsetByteTranslator (com.adaptris.util.text.CharsetByteTranslator)3 ServiceException (com.adaptris.core.ServiceException)1 SimpleByteTranslator (com.adaptris.util.text.SimpleByteTranslator)1