Java Object Serialize and Deserialize deserialized(final byte[] data)

Here you can find the source of deserialized(final byte[] data)

Description

deserialized

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static Object deserialized(final byte[] data) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    @SuppressWarnings("unchecked")
    public static Object deserialized(final byte[] data) throws IOException, ClassNotFoundException {
        if (data == null || data.length == 0)
            return null;
        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
        ObjectInputStream ois = null;
        try {/*from   ww  w  .  j  a v  a  2  s  .co m*/
            ois = new ObjectInputStream(bais);
            return ois.readObject();
        } catch (IOException e) {
            throw e;
        } catch (ClassNotFoundException e) {
            throw e;
        } finally {
            try {
                if (ois != null)
                    ois.close();
            } catch (IOException e) {
                // eat it.
            }
        }
    }
}

Related

  1. deserialize(String serialized)
  2. deserialize(String serializedObject)
  3. deserialize(String str)
  4. deSerialize(String str)
  5. deserializeAndCheckObject(final byte[] object, final Class type)
  6. deserializeFromString(String obj)
  7. deserializeGZip(byte[] buf, T obj)
  8. deserializeJdk(byte[] bytes)
  9. deSerializeObj(byte[] array)