Interface FileResult

All Superinterfaces:
Result
All Known Implementing Classes:
ByteArrayFileResult, LazyInputStreamFileResult, LocalFileResult

public interface FileResult extends Result
A file result is result type which has been produced by a Job and is processed by actions.
By convention, it always implies the flavor FILE.
Not all ResultAction can handle each FileResult, result flavors define the kind of information/data a FileResult represents and actions will handle only results they support. A result can be processed by more than one ResultAction.
Since:
taskplanner 3.0
  • Method Details

    • getFlavors

      default List<ResultFlavor> getFlavors()
      Defined the types of data this Result contains.
      Specified by:
      getFlavors in interface Result
      Returns:
      the ResultFlavor of this Result.
    • getFileSize

      long getFileSize() throws Exception
      Returns the size of this result in bytes.
      Returns:
      the size in bytes
      Throws:
      Exception - if the result data makes problems
      Since:
      taskplanner 3.0
    • getFileContent

      @Nonnull @Nonnull InputStream getFileContent() throws Exception
      Get a stream to access the data of this result.

      Note that this method is called multiple times when more than one action processed this result. Those calls come one after another: the first has finished it's work (closed the stream) when the second calls this method.

      The caller will close the Stream.

      Returns:
      an InputStream which can transfer the data of this result
      Throws:
      Exception - if there is a problem accessing the data
      Since:
      taskplanner 3.0
    • getFileContentType

      @Nullable @Nullable String getFileContentType() throws Exception
      Get the MIME type this result has.
      Returns:
      the content type of this result. When null, 'application/octet-stream' is to be used.
      Throws:
      Exception - if the type is could not be determined due to an IO problem
      Since:
      taskplanner 3.0
    • getFileName

      @Nonnull @Nonnull String getFileName()
      Returns a human readable name of this result, typically a file name.

      It depends on the Result-implementation and on the ResultAction whether and where this appears. E.g. in an email this will be the name of the attached file of this is a LocalFileResult, if this is a StringTextResult it will not appear in the email.

      Returns:
      a name for this result.
      Since:
      taskplanner 3.0