Interface FileResult
-
- All Superinterfaces:
Result
- All Known Implementing Classes:
ByteArrayFileResult,LocalFileResult
public interface FileResult extends Result
A file result is result type which has been produced by aJoband is processed byactions.
By convention, it always implies the flavorFILE.
Not allResultActioncan handle eachFileResult,result flavorsdefine the kind of information/data aFileResultrepresents and actions will handle only results they support. A result can be processed by more than oneResultAction.- Since:
- taskplanner 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.io.InputStreamgetFileContent()Get a stream to access the data of this result.java.lang.StringgetFileContentType()Get the MIME type this result has.java.lang.StringgetFileName()Returns a human readable name of this result, typically a file name.longgetFileSize()Returns the size of this result in bytes.default java.util.List<ResultFlavor>getFlavors()Defined the types of data this Result contains.-
Methods inherited from interface com.inet.taskplanner.server.api.result.Result
cleanup, supportsFlavor, supportsOneFlavorOf
-
-
-
-
Method Detail
-
getFlavors
default java.util.List<ResultFlavor> getFlavors()
Defined the types of data this Result contains.- Specified by:
getFlavorsin interfaceResult- Returns:
- the
ResultFlavorof this Result.
-
getFileSize
long getFileSize() throws java.lang.ExceptionReturns the size of this result in bytes.- Returns:
- the size in bytes
- Throws:
java.lang.Exception- if the result data makes problems- Since:
- taskplanner 3.0
-
getFileContent
@Nonnull java.io.InputStream getFileContent() throws java.lang.ExceptionGet a stream to access the data of this result.Note that this method is called multiple times when more than one
actionprocessed 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:
java.lang.Exception- if there is a problem accessing the data- Since:
- taskplanner 3.0
-
getFileContentType
@Nullable java.lang.String getFileContentType() throws java.lang.ExceptionGet the MIME type this result has.- Returns:
- the content type of this result. When null, 'application/octet-stream' is to be used.
- Throws:
java.lang.Exception- if the type is could not be determined due to an IO problem- Since:
- taskplanner 3.0
-
getFileName
@Nonnull java.lang.String getFileName()
Returns a human readable name of this result, typically a file name.It depends on the
Result-implementation and on theResultActionwhether and where this appears. E.g. in an email this will be the name of the attached file of this is aLocalFileResult, if this is aStringTextResultit will not appear in the email.- Returns:
- a name for this result.
- Since:
- taskplanner 3.0
-
-