Here you can find the source of deserializeObject(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
ClassNotFoundException | an exception |
public static Object deserializeObject(byte[] bytes) throws IOException, ClassNotFoundException
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.zip.InflaterInputStream; public class Main { /**//from w w w. j a v a 2s . c o m * deserialize the compress bytes * @param bytes * @throws IOException * @throws ClassNotFoundException * @return Object deserialized object */ public static Object deserializeObject(byte[] bytes) throws IOException, ClassNotFoundException { if ((bytes == null) || (bytes.length == 0)) { return null; } ByteArrayInputStream inbytes = new ByteArrayInputStream(bytes); InflaterInputStream inflating = new InflaterInputStream(inbytes); ObjectInputStream in = new ObjectInputStream(inflating); Object deserializedObject = in.readObject(); in.close(); return deserializedObject; } }