static public Object deserialize ( InputStream in , Class < ? > cls ) throws IOException { if ( cls == null ) throw new NullPointerException ( "cls" ) ; Object obj = deserialize ( in ) ; if ( ! cls . isInstance ( obj ) ) { throw new InvalidObjectException ( "type of deserialized instance not of required class." ) ; } return obj ; }
Deserializes the object contained in the given input stream .