Java Utililty Methods Object Deserialize

List of utility methods to do Object Deserialize

Description

The list of methods to do Object Deserialize are organized into topic(s).

Method

TdeserializeFromBytes(byte[] serializedObject)
deserialize From Bytes
try {
    ByteArrayInputStream bais = new ByteArrayInputStream(serializedObject);
    ObjectInputStream ois = new ObjectInputStream(bais);
    return (T) ois.readObject();
} catch (IOException e) {
    throw new IllegalStateException(e);
} catch (ClassNotFoundException e) {
    throw new IllegalStateException(e);
...
ObjectdeserializeObject(byte[] buf)
deserialize Object
try (ObjectInputStream inStream = new ObjectInputStream(new ByteArrayInputStream(buf))) {
    return inStream.readObject();
ObjectdeserializeObject(byte[] bytes)
deserialize Object
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
try {
    ObjectInputStream ois = new ObjectInputStream(is);
    try {
        return ois.readObject();
    } finally {
        ois.close();
} finally {
    is.close();
TdeserializeObject(byte[] bytes)
Deserialize an object that had been serialized via #serializeObject(Object) .
try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
    return (T) ois.readObject();
TdeserializeObject(byte[] bytes)
deserialize Object
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
try {
    ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
    return (T) objectInputStream.readObject();
} catch (IOException e) {
    e.printStackTrace();
} catch (ClassNotFoundException e) {
    e.printStackTrace();
...
SerializabledeserializeObject(byte[] bytes)
Deserializes an object instance.
Serializable obj = null;
try {
    ObjectInputStream stream = new ObjectInputStream(new ByteArrayInputStream(bytes));
    obj = (Serializable) stream.readObject();
    stream.close();
} catch (IOException | ClassNotFoundException e0) {
    throw new RuntimeException(e0);
return obj;
ObjectdeserializeObject(byte[] bytes)
deserialize the compress bytes
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();
...
ObjectdeserializeObject(byte[] data)
Deserialize a byte array, ready to cast
ByteArrayInputStream bais = new ByteArrayInputStream(data);
Object o = null;
try {
    ObjectInputStream oin = new ObjectInputStream(bais);
    o = oin.readObject();
} catch (IOException | ClassNotFoundException e) {
    e.printStackTrace();
return o;
ObjectdeSerializeObject(byte[] data)
de Serialize Object
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
if (data == null || data.length == 0) {
    return null;
try {
    bis = new ByteArrayInputStream(data);
    ois = new ObjectInputStream(bis);
...
ObjectdeserializeObject(byte[] data)
deserialize Object
try {
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    BufferedInputStream bis = new BufferedInputStream(bais);
    ObjectInputStream ois = new ObjectInputStream(bis);
    Object result = ois.readObject();
    ois.close();
    return result;
} catch (EOFException e) {
...