Class MolConverter

    • Method Detail

      • setIgnoreError

        public void setIgnoreError​(boolean ignoreError)
        Sets the 'ignoreError' option. If true then processing is continued with the next molecule on error, otherwise processing is interrupted on error. Default: false.
        Parameters:
        ignoreError - true if processing should be continued on error
        Since:
        Marvin 5.3
      • setThreadCount

        public void setThreadCount​(int threadCount)
                            throws IllegalStateException
        Sets the number of threads for concurrent processing. Default: the number of CPUs, single-threaded processing if there is 1 CPU.
        Parameters:
        threadCount - the number of threads, set 0 for the number of CPUs, 1 for single-threaded mode
        Throws:
        IllegalStateException - if called after call to convert().
        Since:
        Marvin 5.3
      • otell

        public long otell()
                   throws IOException
        Get the current file position.
        Returns:
        the position
        Throws:
        IOException - if the position cannot be determined
      • close

        public void close​(int opts)
                   throws IOException
        Closes the exporter. If the output stream is specified by the user, then this method only closes it if the MolExporter.C_CLOSE_STREAM option is used. If the input stream was opened internally, then the opts argument has no effect, the output stream is always closed.
        Parameters:
        opts - closing options for the exporter, applied only if the output stream is specified by the user
        Throws:
        MolExportException - export error.
        IOException - in case of any other I/O error.
        Since:
        Marvin 5.2.2, 04/21/2009
        See Also:
        MolExporter.C_CLOSE_STREAM, MolExporter.C_FLUSH_STREAM
      • createMolConverter

        public static MolConverter createMolConverter​(InputStream instream,
                                                      OutputStream outstream,
                                                      String[] args,
                                                      int[] verbosityLevel)
                                               throws IOException
        Creates a MolConverter instance with the attributes specified in the parameters. Basically allows two usage scenario:
        • command line usage (from within the main method),
        • programmatica usage (like from within the JChem Cartridge Servlet).
        Parameters:
        instream - the input stream to take the molecule definition from. It must be null when called for command line usage.
        outstream - the output stream to write the result onto. It must be null when called for command line usage.
        args - space separated options of attributes/options for the desired MolConverter instance.
        verbosityLevel - may be used by the caller to retrieve (as the first element of the array) the verbosity level specified in args. Must be either at least one element long or (if the caller is not interested in this value) null.
        Throws:
        IllegalCharsetNameException - if illegal input or output encoding name specified
        UnsupportedCharsetException - if the specified input or output encoding is unsupported
        IOException
      • main

        public static void main​(String[] args)
                         throws IOException
        Main method.
        Parameters:
        args - command line arguments
        Throws:
        IOException
      • mainWithoutExit

        public static void mainWithoutExit​(String[] args)
                                    throws IOException
        Same as main(), but never calls System.exit(). Useful to call from other java programs. Instead of exiting the JVM, a RuntimeException may be thrown with text "molconvert exit:<exit status>"
        Parameters:
        args - arguments passed to main().
        Throws:
        IOException