public class SerializObject extends Object
| Constructor and Description |
|---|
SerializObject() |
| Modifier and Type | Method and Description |
|---|---|
static String |
byte2hex(byte[] b)
将二进制转换成字符串
|
static byte[] |
hex2byte(String str)
将字符串转换成二进制数组
|
static Object |
serializFile2Obj(String path)
将文件反序列化成对实例化对象
|
static boolean |
serializObj2File(Object o,
String path)
将对象序列化保存为文件
|
static String |
serializObj2String(Object o)
将对象序列化成字符串
|
static Object |
serializString2Obj(String line)
将字符串反序列化成对实例化对象
|
public static boolean serializObj2File(Object o, String path) throws IOException
o - 实现了Serializable接口的对象path - 文件保存路径IOException - IO异常public static String serializObj2String(Object o) throws IOException
o - 实现了Serializable接口的对象IOException - IO异常public static Object serializFile2Obj(String path) throws IOException, ClassNotFoundException
path - 文件路径IOException - IO异常ClassNotFoundException - 找不到类public static Object serializString2Obj(String line) throws IOException, ClassNotFoundException
line - 序列化字符串IOException - IO异常ClassNotFoundException - 找不到类public static String byte2hex(byte[] b)
b - 数组public static byte[] hex2byte(String str)
str - 字符串Copyright © 2017. All rights reserved.