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 aJob
and is processed byactions
.
By convention, it always implies the flavorFILE
.
Not allResultAction
can handle eachFileResult
,result flavors
define the kind of information/data aFileResult
represents 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.InputStream
getFileContent()
Get a stream to access the data of this result.java.lang.String
getFileContentType()
Get the MIME type this result has.java.lang.String
getFileName()
Returns a human readable name of this result, typically a file name.long
getFileSize()
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:
getFlavors
in interfaceResult
- Returns:
- the
ResultFlavor
of this Result.
-
getFileSize
long getFileSize() throws java.lang.Exception
Returns 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.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:
java.lang.Exception
- if there is a problem accessing the data- Since:
- taskplanner 3.0
-
getFileContentType
@Nullable java.lang.String getFileContentType() throws java.lang.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:
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 theResultAction
whether 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 aStringTextResult
it will not appear in the email.- Returns:
- a name for this result.
- Since:
- taskplanner 3.0
-
-