public class ObjectIOs extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
deserialize(byte[] bytes) |
static <T> T |
deserialize(byte[] bytes,
Class<T> targetType) |
static <T> byte[] |
serialize(T obj)
使用 JDK 的 output stream 写对象。
|
static <T> void |
serialize(T obj,
OutputStream outputStream)
序列化到指定的输出流
|
public static <T> byte[] serialize(T obj)
throws IOException
obj - 必须实现 Serializable 接口IOExceptionpublic static <T> void serialize(T obj,
@NonNull
OutputStream outputStream)
throws IOException
IOExceptionpublic static <T> T deserialize(byte[] bytes)
throws IOException,
ClassNotFoundException
public static <T> T deserialize(byte[] bytes,
@Nullable
Class<T> targetType)
throws IOException,
ClassNotFoundException
Copyright © 2020. All rights reserved.