zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    javascript解决方案插件
    vscode前端快速开发插件
    html5新增语义标签
    vscode快捷键大全
    vscode/sublime前端开发快捷键
    vscode自动缩进快捷键
    Android平台OpenGL ES/Assimp/OpenCV/GLM集成说明
    将AOSP源码导入到Android Studio进行查看
    Android OTA升级
    Android构建系统
  • 原文地址:https://www.cnblogs.com/kuyuyingzi/p/4266302.html
Copyright © 2011-2022 走看看