参考官方文档的描述,下面做一些简要描述,http://hessian.caucho.com/doc/hessian-serialization.html。
1、它必须自我描述序列化类型,即不需要外部模式或接口定义
2、它必须是独立于语言的,包括支持脚本语言
3、它必须是可以通过单一方式进行读写
4、它必须尽可能紧凑
5、它必须简单,这样才能有效地测试和实现
6、必须尽可能地快
7、它必须支持Unicode字符串
8、它必须支持8位二进制数据,而不需要转义或使用附件
9、它必须支持加密、压缩、签名和事务上下文信封
hessian语法简介
参考:http://hessian.caucho.com/doc/hessian-serialization.html。(看不懂,意思一下)
hessian序列化与反序列化举例
public static void serialize1(Student student){
FileOutputStream fileOutputStream;
try {
fileOutputStream = new FileOutputStream("/Users/zhuqiuhui/Desktop/studentHession.txt");
// 从对象中获取字节流
ByteArrayOutputStream os = new ByteArrayOutputStream();
Hessian2Output output = new Hessian2Output(os);
output.writeObject(student);
output.getBytesOutputStream().flush();
output.completeMessage();
output.close();

本文详细介绍了Hessian序列化的原理,包括其自我描述、语言独立性、紧凑性等特性,并对比了与Java序列化的区别。Hessian序列化不需要`serialVersionUID`,且在处理对象继承时有特定的行为。同时,文章还探讨了序列化对象实现`Serializable`接口的重要性以及`writeReplace`和`readResolve`方法在Hessian序列化中的作用。
最低0.47元/天 解锁文章
1153

被折叠的 条评论
为什么被折叠?



