Java Object Deserialize deserializeObject(byte[] data, Class clazz)

Here you can find the source of deserializeObject(byte[] data, Class clazz)

Description

deserialize Object

License

Apache License

Declaration

public static <T> T deserializeObject(byte[] data, Class<T> clazz) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayInputStream;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

public class Main {
    public static <T> T deserializeObject(byte[] data, Class<T> clazz) throws IOException, ClassNotFoundException {

        return deserializeObject(new ByteArrayInputStream(data), clazz);
    }/* ww  w.ja v  a 2  s  .c o m*/

    public static <T> T deserializeObject(InputStream in, Class<T> clazz)
            throws IOException, ClassNotFoundException {

        ObjectInputStream oin = new ObjectInputStream(in);
        return clazz.cast(oin.readObject());
    }
}

Related

  1. deserializeObject(byte[] bytes)
  2. deserializeObject(byte[] bytes)
  3. deserializeObject(byte[] data)
  4. deSerializeObject(byte[] data)
  5. deserializeObject(byte[] data)
  6. deserializeObject(byte[] obj)
  7. deserializeObject(byte[] serializedObj)
  8. deserializeObject(File file)
  9. deserializeObject(File inFile)