public static Serializable fromByteArray ( byte [ ] data ) { try { ByteArrayInputStream buf = new ByteArrayInputStream ( data ) ; ObjectInputStream objIn = new ObjectInputStream ( buf ) ; Serializable response = ( Serializable ) objIn . readObject ( ) ; objIn . close ( ) ; return response ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Cannot deserialize object : " + e . toString ( ) ) ; } }
Byte array to object