Here you can find the source of deserializeObject(byte[] data, Class
public static <T> T deserializeObject(byte[] data, Class<T> clazz) throws IOException, ClassNotFoundException
//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()); } }