Java Object Deserialize deserialize(byte[] data)

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

Description

deserialize

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static <T> T deserialize(byte[] data) 

Method Source Code

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

import java.io.ByteArrayInputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> T deserialize(byte[] data) {
        ObjectInputStream ois = null;
        ByteArrayInputStream is = null;
        try {/*from   w  ww.  j  a v  a2 s. co m*/
            is = new ByteArrayInputStream(data);
            ois = new ObjectInputStream(is);
            return (T) ois.readObject();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (ois != null) {
                try {
                    is.close();
                    ois.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return null;
    }
}

Related

  1. deserialize(byte[] bytes, Class clazz)
  2. deserialize(byte[] bytes, Class klass)
  3. deserialize(byte[] bytes, final Class asClass)
  4. deserialize(byte[] bytes, List customClassLoaders)
  5. deserialize(byte[] data)
  6. deserialize(byte[] data)
  7. deserialize(byte[] data)
  8. deserialize(byte[] data)
  9. deserialize(byte[] data)