ralborodo-RatedPower commented on issue #2302:
URL: https://github.com/apache/fory/issues/2302#issuecomment-2984097516
Hi @chaokunyang ... bothering you again... I was trying to use the
MemoryBuffer avoiding rewritting them (as you suggested before) but we are
getting null as result of the desearialization.
The code we are using to deserialize is the following (it receives the file
to deserialize as a byte array)
```
public FuryParentDTO deserialize(byte[] bytes) {
int sizePerBuffer = Math.ceilDiv(bytes.length, BUFFER_COUNT);
byte[] result = new byte[bytes.length];
List<MemoryBuffer> byteBuffers = new ArrayList<>(BUFFER_COUNT);
int starting = 0;
for(int i = 0; i < BUFFER_COUNT; i++) {
int size = Math.min(sizePerBuffer, bytes.length -
starting);
MemoryBuffer memoryBuffer = MemoryUtils.wrap(result,
starting, size); // Ensure the
byteBuffers.add(memoryBuffer);
starting += sizePerBuffer;
}
return (FuryParentDTO) fory.deserialize(bytes, byteBuffers);
}
```
Investigating a little bit further, I found where I am getting the null. It
seems like the initial byte cannot be -1. Assigning 1 to the starting variable
I got the exact same result.

--
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]