/**
* 将压缩后的 Object 数据解压缩
*
* @param compressed 压缩后的 Object 数据
* @return 解压后的字符串 Object
* @throws Exception
*/
public static final Object decompress(Object compressed) {
if(compressed == null)
return null;
InputStream in = null;
ZipInputStream zin = null;
ObjectInputStream oin = null;
try {
byte[] by= new BASE64Decoder().decodeBuffer(compressed.toString());
in =new ByteArrayInputStream(by);
zin = new ZipInputStream(in);
zin.getNextEntry();
oin = new ObjectInputStream(zin);
return oin.readObject();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(oin != null) {
try {oin.close();} catch(IOException e) {}
}
if(zin != null) {
try {zin.close();} catch(IOException e) {}
}
if(in != null) {
try {in.close();} catch(IOException e) {}
}
}
}
字符串解压
最新推荐文章于 2021-12-14 08:39:05 发布