doc
This commit is contained in:
@@ -1,38 +1,38 @@
|
|||||||
# 序列化
|
# 序列化
|
||||||
  Convert提供Java对象的序列化与反序列化功能。支持JSON(JavaScript Object Notation)、PROTOBUF两种格式化。 两种格式使用方式完全一样,其性能都大幅度超过其他JSON框架。同时JSON内置于HTTP服务中,PROTOBUF也是SNCP协议数据序列化的基础。
|
  Convert提供Java对象的序列化与反序列化功能。支持JSON、PROTOBUF两种格式化。 两种格式使用方式完全一样,其性能都大幅度超过其他JSON框架。同时JSON内置于HTTP服务中,PROTOBUF也是SNCP协议数据序列化的基础。
|
||||||
## 基本API
|
## 基本API
|
||||||
  JSON序列化其操作类主要是JsonConvert,配置类主要是JsonFactory、ConvertColumn。JsonFactory采用同ClassLoader类似的双亲委托方式设计。
|
  JSON序列化其操作类主要是JsonConvert,配置类主要是JsonFactory、ConvertColumn。JsonFactory采用同ClassLoader类似的双亲委托方式设计。
|
||||||
JsonConvert 序列化encode方法:
|
JsonConvert 序列化encode方法:
|
||||||
```java
|
```java
|
||||||
public String convertTo(Object value);
|
public String convertTo(Object value);
|
||||||
|
|
||||||
public String convertTo(Type type, Object value);
|
public String convertTo(Type type, Object value);
|
||||||
|
|
||||||
public void convertTo(OutputStream out, Object value);
|
public byte[] convertToBytes(Type type, Object value);
|
||||||
|
|
||||||
public void convertTo(OutputStream out, Type type, Object value);
|
public void convertTo(OutputStream out, Type type, Object value);
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(Supplier<ByteBuffer> supplier, Object value);
|
|
||||||
|
|
||||||
public ByteBuffer[] convertTo(Supplier<ByteBuffer> supplier, Type type, Object value);
|
public ByteBuffer[] convertTo(Supplier<ByteBuffer> supplier, Type type, Object value);
|
||||||
|
|
||||||
public void convertTo(JsonWriter writer, Object value);
|
|
||||||
|
|
||||||
public void convertTo(JsonWriter writer, Type type, Object value);
|
public void convertTo(JsonWriter writer, Type type, Object value);
|
||||||
```
|
```
|
||||||
JsonConvert 反序列化decode方法:
|
JsonConvert 反序列化decode方法:
|
||||||
```java
|
```java
|
||||||
public <T> T convertFrom(Type type, String text);
|
public <T> T convertFrom(Type type, String text);
|
||||||
|
|
||||||
public <T> T convertFrom(Type type, char[] text);
|
|
||||||
|
|
||||||
public <T> T convertFrom(Type type, char[] text, int start, int len);
|
|
||||||
|
|
||||||
public <T> T convertFrom(Type type, InputStream in);
|
public <T> T convertFrom(Type type, InputStream in);
|
||||||
|
|
||||||
public <T> T convertFrom(Type type, ByteBuffer... buffers);
|
public <T> T convertFrom(Type type, ByteBuffer... buffers);
|
||||||
|
|
||||||
public <T> T convertFrom(Type type, JsonReader reader);
|
public <T> T convertFrom(Type type, JsonReader reader);
|
||||||
|
|
||||||
|
public Object[] convertFrom(Type[] types, String text);
|
||||||
|
|
||||||
|
// 返回非null的值是由String、ArrayList、HashMap任意组合的对象
|
||||||
|
public <V> V convertFrom(final String text);
|
||||||
|
|
||||||
|
// 返回非null的值是由String、ArrayList、HashMap任意组合的对象
|
||||||
|
public <V> V convertFrom(final InputStream in);
|
||||||
```
|
```
|
||||||
## JSON基本用法
|
## JSON基本用法
|
||||||
```java
|
```java
|
||||||
|
|||||||
Reference in New Issue
Block a user