/* (non-Javadoc) * @see org.directmemory.utils.Serializer#serialize(java.lang.Object, java.lang.Class) */ @SuppressWarnings("unchecked") public byte[] serialize(Object obj, @SuppressWarnings("rawtypes") Class clazz) throws IOException { @SuppressWarnings("rawtypes") Schema schema = RuntimeSchema.getSchema(clazz); final LinkedBuffer buffer = LinkedBuffer.allocate(serBufferSize); byte[] protostuff = null; try { protostuff = ProtostuffIOUtil.toByteArray(obj, schema, buffer); } finally { buffer.clear(); } return protostuff; }
public <T> byte[] toByteArray(T message, Schema<T> schema) { return ProtostuffIOUtil.toByteArray(message, schema, buf()); }
@Override public <T> byte[] serializeInternal( final T source, final Schema<T> schema, final LinkedBuffer buffer) { return ProtostuffIOUtil.toByteArray(source, schema, buffer); }