TypeEncoder { static String encodeString(Utf8String string) { byte[] utfEncoded = string.getValue().getBytes(Charset.forName("UTF-8")); return encodeDynamicBytes(new DynamicBytes(utfEncoded)); } private  TypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter);  }
@Test public void testUtf8String() { Utf8String string = new Utf8String("Hello, world!"); assertThat(TypeEncoder.encodeString(string), is("000000000000000000000000000000000000000000000000000000000000000d" + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000")); }