public static Serializable deserialize ( byte [ ] bytes ) throws IOException , ClassNotFoundException { if ( bytes == null ) { return null ; } try ( ByteArrayInputStream b = new ByteArrayInputStream ( bytes ) ) { try ( ObjectInputStream o = new ObjectInputStream ( b ) ) { return ( Serializable ) o . readObject ( ) ; } } }
Deserializes a byte array into an object . When the bytes are null returns null .