Exemple #1
0
        public virtual IChemObjectReader createReader(string filename, StreamReader input)
        {
            IChemFormat       chemFormat = guessFormatByExtension(filename);
            IChemObjectReader coReader   = createReader(chemFormat);

            try
            {
                coReader.setReader(input);
            }
            catch { }
            return(coReader);
        }
Exemple #2
0
        /// <summary> Detects the format of the Reader input, and if known, it will return
        /// a CDK Reader to read the format. This method is not able to detect the
        /// format of gziped files. Use createReader(InputStream) instead for such
        /// files.
        ///
        /// </summary>
        /// <seealso cref="createReader(InputStream)">
        /// </seealso>
        //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
        public virtual IChemObjectReader createReader(System.IO.StreamReader input)
        {
            if (!(input is System.IO.StreamReader))
            {
                //UPGRADE_TODO: The differences in the expected value  of parameters for constructor 'java.io.BufferedReader.BufferedReader'  may cause compilation errors.  "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'"
                input = new System.IO.StreamReader(input.BaseStream, input.CurrentEncoding);
            }
            IChemFormat       chemFormat = guessFormat((System.IO.StreamReader)input);
            IChemObjectReader coReader   = createReader(chemFormat);

            try
            {
                coReader.setReader(input);
            }
            catch (System.Exception exception)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("Could not set the Reader source: ", exception.Message);
                //logger.debug(exception);
            }
            return(coReader);
        }