@Override public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException { return ProtobufUtil.fromWrappedByteArray(getSerializationContext(), buf, offset, length); }
@Override public boolean isMarshallable(Object o) { // our marshaller can handle all of these primitive/scalar types as well even if we do not // have a per-type marshaller defined in our SerializationContext return o instanceof String || o instanceof Long || o instanceof Integer || o instanceof Double || o instanceof Float || o instanceof Boolean || o instanceof byte[] || o instanceof Byte || o instanceof Short || o instanceof Character || o instanceof java.util.Date || o instanceof java.time.Instant || getSerializationContext().canMarshall(o.getClass()); }
@Override protected ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException, InterruptedException { byte[] bytes = ProtobufUtil.toWrappedByteArray(getSerializationContext(), o); return new ByteBufferImpl(bytes, 0, bytes.length); }