shuyufang opened a new issue, #1928:
URL: https://github.com/apache/fury/issues/1928
### Question
public class FurySerializer implements Serializer {
/**
* fury配置
*/
private static final ThreadSafeFury fury = new
FuryBuilder().withLanguage(Language.JAVA)
.withRefTracking(true)
.requireClassRegistration(false)
.withDeserializeNonexistentClass(true)
.withMetaShare(true)
.withAsyncCompilation(true)
.withCompatibleMode(CompatibleMode.COMPATIBLE)
.withScopedMetaShare(true)
.withCodegen(true).buildThreadSafeFury();
@Override
public byte[] serialize(Object obj, Integer feature) throws
SerializerException {
try {
return fury.serializeJavaObject(obj);
} catch (Exception e) {
logger.error("[FurySerializer.serialize] exception " +
e.getMessage(), e);
throw new SerializerException(e.toString(), e);
}
}
@Override
public <T> T deserialize(byte[] bytes, Class<T> cls) throws
SerializerException {
try {
return fury.deserializeJavaObject(bytes, cls);
} catch (Exception e) {
logger.error("[FurySerializer.deserialize] exception " +
e.getMessage(), e);
throw new SerializerException(e.toString(), e);
}
}
public class FurySerializerTest {
private FurySerializer furySerializer = new FurySerializer();
@Test
public void test() {
try {
byte[] byteBuf = new byte[9000];
// 20241029201856_0B5DEB3A16AD446626A7948A497B9008_84110 Y
// 20240904171221_212BA390147466B59B7D1320A7820000_84110 F
String file =
"/home/admin/upload/20241029201856_0B5DEB3A16AD446626A7948A497B9008_84110";
InputStream input = Files.newInputStream(new
File(file).toPath());
int read = IOUtils.read(input, byteBuf);
System.out.println(read);
furySerializer.deserialize(byteBuf, AsynMessageRequest.class);
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertTrue(true);
}
}

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