public static Identity fromByteArray ( final byte [ ] anArray ) throws PersistenceBrokerException { // reverse of the serialize() algorithm: // read from byte[] with a ByteArrayInputStream, decompress with // a GZIPInputStream and then deserialize by reading from the ObjectInputStream try { final ByteArrayInputStream bais = new ByteArrayInputStream ( anArray ) ; final GZIPInputStream gis = new GZIPInputStream ( bais ) ; final ObjectInputStream ois = new ObjectInputStream ( gis ) ; final Identity result = ( Identity ) ois . readObject ( ) ; ois . close ( ) ; gis . close ( ) ; bais . close ( ) ; return result ; } catch ( Exception ex ) { throw new PersistenceBrokerException ( ex ) ; } }
Factory method that returns an Identity object created from a serializated representation .