public static <T>T deserialise(byte[] bytes,boolean compressed,ClassLoader classLoader) throws IOException, ClassNotFoundException {
  final ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
  final ObjectInputStream ois=compressed ? new WhitelistObjectInputStream(new InflaterInputStream(bais),classLoader) : new WhitelistObjectInputStream(bais,classLoader);
  final T result;
  try {
    result=(T)ois.readObject();
  }
  finally {
    closeIfNotNull(ois);
  }
  return result;
}

public static < T > T deserialise ( byte [ ] bytes , boolean compressed , ClassLoader classLoader ) throws IOException , ClassNotFoundException { final ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; final ObjectInputStream ois = compressed ? new WhitelistObjectInputStream ( new InflaterInputStream ( bais ) , classLoader ) : new WhitelistObjectInputStream ( bais , classLoader ) ; final T result ; try { result = ( T ) ois . readObject ( ) ; } finally { closeIfNotNull ( ois ) ; } return result ; }
deserialises an object from a byte array to an object of a specified type .
