public ISimpleChemObjectReader createReader ( IChemFormat format ) { if ( format != null ) { String readerClassName = format . getReaderClassName ( ) ; if ( readerClassName != null ) { try { // make a new instance of this class return ( ISimpleChemObjectReader ) this . getClass ( ) . getClassLoader ( ) . loadClass ( readerClassName ) . newInstance ( ) ; } catch ( ClassNotFoundException exception ) { logger . error ( "Could not find this ChemObjectReader: " , readerClassName ) ; logger . debug ( exception ) ; } catch ( InstantiationException | IllegalAccessException exception ) { logger . error ( "Could not create this ChemObjectReader: " , readerClassName ) ; logger . debug ( exception ) ; } } else { logger . warn ( "ChemFormat is recognized, but no reader is available." ) ; } } else { logger . warn ( "ChemFormat is not recognized." ) ; } return null ; }
Creates a new IChemObjectReader based on the given IChemFormat .