Kryo 2.21 发布了,下载地址: kryo-2.21.zip (1.7 MB)
Kryo 是一个快速高效的Java对象图形序列号框架,主要特点是性能、高效和易用。该项目用来序列化对象到文件、数据库或者网络。
示例代码:
01 | Kryo kryo = new Kryo(); |
02 | // ... |
03 | Output output = new Output( new FileOutputStream( "file.bin" )); |
04 | SomeClass someObject = ... |
05 | kryo.writeObject(output, someObject); |
06 | output.close(); |
07 | // ... |
08 | Input input = new Input( new FileInputStream( "file.bin" )); |
09 | SomeClass someObject = kryo.readObject(input, SomeClass. class ); |
10 | input.close(); |