public byte[] serialize(List<String> result) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JavaBinCodec codec = new JavaBinCodec(null);
codec.marshal(result,bos);
return bos.toByteArray();
}
public List<String> deserialize(byte[] binaryResult) throws IOException{
ByteArrayInputStream bis = new ByteArrayInputStream(binaryResult);
JavaBinCodec codec = new JavaBinCodec(null);
List<String> result = (List<String>)codec.unmarshal(bis);
return result;
}
可序列化对象压缩和解压缩byte数组实例
最新推荐文章于 2023-10-26 17:36:55 发布