fperez-RatedPower commented on issue #2302:
URL: https://github.com/apache/fory/issues/2302#issuecomment-2948569510

   @chaokunyang I was able to find that after your suggestion, however I am 
struggling to implement it. I was able to get the serialization working, but 
not the deserialization. 
   
   I need to separate the serialization from the deserialization, since they 
occur in different servers.
   
   This is my currently failing attempt, i get an IllegalArgumentException at 
Fury.java:readBufferObject, when checking if the outOfBandBuffers.hasNext
   
   ```
        public byte[] serializeZc(FuryParentDTO furyDTO){
                Collection<BufferObject> bufferObjects = new ArrayList<>();
                return fury.serialize(furyDTO, e -> !bufferObjects.add(e));
        }
   
        public FuryParentDTO deserializeZc(byte[] bytes) {
                ByteBuffer buffer = ByteBuffer.allocateDirect(4096);
                BufferObject.ByteBufferBufferObject bufferObject =
                                new BufferObject.ByteBufferBufferObject(buffer);
   
                List<MemoryBuffer> buffers = Stream.of(bufferObject)
                        .map(BufferObject::toBuffer)
                        .collect(Collectors.toList());
                return (FuryParentDTO) fury.deserialize(bytes, buffers);
        }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to