ByteArrayOutputStream out = new ByteArrayOutputStream();
FixedLengthStringCodec codec = new FixedLengthStringCodec(
Charset.forName("UTF-16BE"), sizeExpr, "",
new BoundString.NullConverter());
codec.encode(original, new OutputStreamBitChannel(out), resolver);
byte[] encoded = out.toByteArray();
assertThat(encoded.length, is(size));
BitBuffer buffer = new DefaultBitBuffer(ByteBuffer.wrap(encoded));
String result = codec.decode(buffer, resolver, builder);