public static Object deserialize ( byte [ ] bytes , boolean gzipOnSerialize ) { try { InputStream is = new ByteArrayInputStream ( bytes ) ; if ( gzipOnSerialize ) { is = new GZIPInputStream ( is ) ; } ObjectInputStream in = new ObjectInputStream ( is ) ; Object inObj = in . readObject ( ) ; in . close ( ) ; return inObj ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } }
Deserialize and ungzip an object .