public static < K > K deserialize ( byte [ ] bytes ) { try { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( bytes ) ; ObjectInputStream objectInputStream = new ObjectInputStream ( byteArrayInputStream ) ; @ SuppressWarnings ( "unchecked" ) final K k = ( K ) objectInputStream . readObject ( ) ; return k ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } }
De - serialize a byte array back to it s original object .