• java快速序列化库FST


    FST fast-serialization 是重新实现的 Java 快速对象序列化的开发包。序列化速度更快(2-10倍)、体积更小,而且兼容 JDK 原生的序列化。要求 JDK 1.7 支持。

    Maven:

    1	<dependency>
    2	    <groupId>de.ruedigermoeller</groupId>
    3	    <artifactId>fst</artifactId>
    4	    <version>1.36</version>
    5	</dependency>


    示例代码:

    01	// ! reuse this Object, it caches metadata. Performance degrades massively
    02	// if you create a new Configuration Object with each serialization !
    03	static FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
    04	...
    05	public MyClass myreadMethod(InputStream stream) throws IOException, ClassNotFoundException
    06	{
    07	    FSTObjectInput in = conf.getObjectInput(stream);
    08	    MyClass result = in.readObject(MyClass.class);
    09	    // DON'T: in.close(); here prevents reuse and will result in an exception      
    10	    stream.close();
    11	    return result;
    12	}
    13	 
    14	public void mywriteMethod( OutputStream stream, MyClass toWrite ) throws IOException 
    15	{
    16	    FSTObjectOutput out = conf.getObjectOutput(stream);
    17	    out.writeObject( toWrite, MyClass.class );
    18	    // DON'T out.close() when using factory method;
    19	    out.flush();
    20	    stream.close();
    21	}

    开源中国:http://www.oschina.net/p/fst

  • 相关阅读:
    软件测试——C#判断密码是否符合要求
    软件测试——C#判断闰年的form小程序
    初识JUnit
    软件测试的方法一共有几种
    多个异步请求调用一个回调函数
    单元测试、集成测试、系统测试总结
    软件测试同行评审流程
    白盒测试总结
    黑盒测试总结
    闰年测试
  • 原文地址:https://www.cnblogs.com/kuyuyingzi/p/4266302.html
Copyright © 2020-2023  润新知