chaokunyang commented on issue #1564: URL: https://github.com/apache/incubator-fury/issues/1564#issuecomment-2074731206
I can run this successfully locally:  Here is my code: ```java package org.apache.fury; import lombok.Data; import org.apache.fury.config.CompatibleMode; import org.apache.fury.logging.LoggerFactory; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.file.Files; public class Test { @Data public static class AssignDetailInfoLog { String id; AssignType type; } public enum AssignType { DEFAULT; } public static class FuryUtils { private static final ThreadSafeFury fury; public FuryUtils() { } public static <T> byte[] serialize(T t) { return fury.serialize(t); } public static Object zeroCopyDeserialize(byte[] byteBuffer) { return fury.deserialize(byteBuffer); } public static Object zeroCopyDeserialize(ByteBuffer byteBuffer) { return fury.deserialize(byteBuffer); } static { fury = Fury.builder().withRefTracking(true).requireClassRegistration(false).withCompatibleMode(CompatibleMode.COMPATIBLE).buildThreadSafeFury(); LoggerFactory.disableLogging(); } } public static void main(String[] args) throws IOException { // read read(); // write(); } public static void write() throws IOException { AssignDetailInfoLog assignDetailInfoLog = new AssignDetailInfoLog(); assignDetailInfoLog.setType(AssignType.DEFAULT); assignDetailInfoLog.setId("dsa"); byte[] data = FuryUtils.serialize(assignDetailInfoLog); saveToFile("test_file", data); } public static void read() throws IOException { write(); // read byte[] data = readFileToBytes("test_file"); FuryUtils.zeroCopyDeserialize(data); } public static void saveToFile(String fileName, byte[] data) { try (FileOutputStream outputStream = new FileOutputStream(fileName)) { outputStream.write(data); // 写入byte[] System.out.println("Data has been written to " + fileName); } catch (IOException e) { e.printStackTrace(); } } public static byte[] readFileToBytes(String filePath) { try { return Files.readAllBytes(new File(filePath).toPath()); } catch (Exception e) { return null; } } } ``` -- 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]
