Class AbstractFlowReader

    • Field Detail

      • m_Quiet

        protected boolean m_Quiet
        whether to suppress logging output.
    • Constructor Detail

      • AbstractFlowReader

        public AbstractFlowReader()
    • Method Detail

      • getFormatDescription

        public abstract String getFormatDescription()
        Returns a string describing the format (used in the file chooser).
        Specified by:
        getFormatDescription in interface FileFormatHandler
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public abstract String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface FileFormatHandler
        Returns:
        the extension (without the dot!)
      • getInputType

        protected abstract AbstractFlowReader.InputType getInputType()
        Returns how to read the data, from a file, stream or reader.
        Returns:
        how to read the data
      • setQuiet

        public void setQuiet​(boolean value)
        Sets whether to suppress logging output.
        Parameters:
        value - true if to suppress
      • isQuiet

        public boolean isQuiet()
        Returns whether logging output is suppressed.
        Returns:
        true if suppressed
      • check

        protected void check()
        Hook method to perform some checks before performing the actual read.

        Default implementation only clears warnings/errors.
      • readActor

        public Actor readActor​(File file)
        Reads the flow from the specified file.
        Specified by:
        readActor in interface FlowReader
        Parameters:
        file - the file to read from
        Returns:
        null in case of an error, otherwise the flow
      • readActor

        public Actor readActor​(String filename)
        Reads the flow from the given file.
        Specified by:
        readActor in interface FlowReader
        Parameters:
        filename - the file to read from
        Returns:
        the flow or null in case of an error
      • readActor

        public Actor readActor​(InputStream stream)
        Reads the flow from the stream. The caller must ensure to close the stream.
        Specified by:
        readActor in interface FlowReader
        Parameters:
        stream - the stream to read from
        Returns:
        the flow or null in case of an error
      • readActor

        public Actor readActor​(Reader r)
        Reads the flow from the given reader. The caller must ensure to close the reader.
        Specified by:
        readActor in interface FlowReader
        Parameters:
        r - the reader to read from
        Returns:
        the flow or null in case of an error
      • doReadActor

        protected Actor doReadActor​(File file)
        Performs the actual reading.

        Default implementation returns null.
        Parameters:
        file - the file to read from
        Returns:
        the flow or null in case of an error
        See Also:
        getInputType()
      • doReadActor

        protected Actor doReadActor​(Reader r)
        Performs the actual reading.

        Default implementation returns null.
        Parameters:
        r - the reader to read from
        Returns:
        the flow or null in case of an error
        See Also:
        getInputType()
      • doReadActor

        protected Actor doReadActor​(InputStream in)
        Performs the actual reading.

        Default implementation returns null.
        Parameters:
        in - the input stream to read from
        Returns:
        the flow or null in case of an error
        See Also:
        getInputType()
      • addWarning

        protected void addWarning​(String msg)
        Adds the warning message.
        Parameters:
        msg - the warning message to add
      • addWarning

        protected void addWarning​(String msg,
                                  Throwable t)
        Adds the warning message and exception.
        Parameters:
        msg - the warning message to add
        t - the exception, ignored if null
      • addError

        protected void addError​(String msg)
        Adds the error message.
        Parameters:
        msg - the error message to add
      • addError

        protected void addError​(String msg,
                                Throwable t)
        Adds the error message and exception.
        Parameters:
        msg - the error message to add
        t - the exception, ignored if null
      • getReaders

        public static String[] getReaders()
        Returns a list with classnames of readers.
        Returns:
        the reader classnames