Objective-C 序列化框架:KryoCocoa

jopen 9年前

KryoCocoa 是 Kryo 高性能 Java 序列化框架的 Objective-C 移植版本,兼容 Java 版本的序列化格式。

示例代码:

Kryo *kryo = [Kryo new];  // ...  NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:@"file.bin" append:NO];  KryoOutput *output = [[Kryo alloc] initWithStream:outputStream];  SomeClass *someObject = ...  [kryo writeObject:someObject to:output];  [output close];  // ...  NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:@"file.bin"];  KryoInput *input = [[KryoInput alloc] initWithInput:inputStream];  SomeClass *someObject = [kryo readObject:input ofClass:[SomeClass class]];  [input close];

项目主页:http://www.open-open.com/lib/view/home/1433233034869