Class AbstractFlowWriter

    • Constructor Detail

      • AbstractFlowWriter

        public AbstractFlowWriter()
    • 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!)
      • getOutputType

        protected abstract AbstractFlowWriter.OutputType getOutputType()
        Returns how to write the data, from a file, stream or writer.
        Returns:
        how to write the data
      • write

        public boolean write​(Actor content,
                             File file)
        Writes the given content to the specified file.
        Specified by:
        write in interface FlowWriter
        Parameters:
        content - the content to write
        file - the file to write to
        Returns:
        true if successfully written
      • write

        public boolean write​(Actor content,
                             String filename)
        Writes the content to the given file.
        Specified by:
        write in interface FlowWriter
        Parameters:
        content - the content to write
        filename - the file to write the content to
        Returns:
        true if successfully written
      • write

        public boolean write​(Actor content,
                             OutputStream stream)
        Writes the content to the given output stream. The caller must ensure that the stream gets closed.
        Specified by:
        write in interface FlowWriter
        Parameters:
        content - the content to write
        stream - the output stream to write the content to
        Returns:
        true if successfully written
      • write

        public boolean write​(Actor content,
                             Writer writer)
        Writes the content to the given writer. The caller must ensure that the writer gets closed.
        Specified by:
        write in interface FlowWriter
        Parameters:
        content - the content to write
        writer - the writer to write the content to
        Returns:
        true if successfully written
      • doWrite

        protected boolean doWrite​(Actor content,
                                  File file)
        Performs the actual writing. The caller must ensure that the writer gets closed.

        Default implementation returns always false.
        Parameters:
        content - the content to write
        file - the file to write the content to
        Returns:
        true if successfully written
      • doWrite

        protected boolean doWrite​(Actor content,
                                  Writer writer)
        Performs the actual writing. The caller must ensure that the writer gets closed.

        Default implementation returns always false.
        Parameters:
        content - the content to write
        writer - the writer to write the content to
        Returns:
        true if successfully written
      • doWrite

        protected boolean doWrite​(Actor content,
                                  OutputStream out)
        Performs the actual writing. The caller must ensure that the output stream gets closed.

        Default implementation returns always false.
        Parameters:
        content - the content to write
        out - the output stream to write the content to
        Returns:
        true if successfully written
      • getWriters

        public static String[] getWriters()
        Returns a list with classnames of writers.
        Returns:
        the writer classnames