该类库实现了对象的快速序列化/反序列化,专门为java语言打造,后续会支持其它语言。
? ?Demo:
class="notranslate">monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 6px; border: 0px; display: inline; overflow: visible; line-height: inherit;"> ByteArrayOutputStream output = new ByteArrayOutputStream();
//序列化对象
Serial.write(originalValue,output);
output.close();
ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
Object obj = null;
try {
//反序列化
obj = Serial.read(input);
} catch (Exception e) {
e.printStackTrace();
}finally {
input.close();
}
git地址: https://github.com/lujintao2000/serial_pro