public ByteBuffer encodeBinary(final Object o) throws EncodeException {
List<InstanceHandle<? extends Encoder>> decoders = binaryEncoders.get(o.getClass());
if (decoders != null) {
for (InstanceHandle<? extends Encoder> decoderHandle : decoders) {
Encoder decoder = decoderHandle.getInstance();
if (decoder instanceof Encoder.Binary) {
return ((Encoder.Binary) decoder).encode(o);
} else {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();