public static < T > T deSerialize ( byte [ ] bytes , Class < T > adaptee ) throws Exception { ObjectInputStream in = new ObjectInputStream ( new ByteArrayInputStream ( bytes ) ) ; Object readObject = in . readObject ( ) ; return adaptee . cast ( readObject ) ; }
Deserialize a byte array to a given object .