Class StringTextResult
java.lang.Object
com.inet.taskplanner.server.api.result.StringTextResult
- All Implemented Interfaces:
Result
,TextResult
A Result which contains of human readable text.
- Since:
- taskplanner 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionStringTextResult
(String text, String contentType) Creates a new TextResult instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
When result-handling is finished, then this method is called to clean up used system resources, i.e.getText()
Returns the content of the result in form of aString
.@Nonnull InputStream
Returns the content of the result in form of anInputStream
with encodingStandardCharsets.UTF_8
.Get the MIME type this result has.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inet.taskplanner.server.api.result.Result
supportsFlavor, supportsOneFlavorOf
Methods inherited from interface com.inet.taskplanner.server.api.result.TextResult
getFlavors
-
Constructor Details
-
StringTextResult
Creates a new TextResult instance.- Parameters:
text
- the text this result contains.contentType
- the content type, typicalMimeTypes.TXT
orMimeTypes.HTM
- Since:
- taskplanner 3.0
-
-
Method Details
-
getTextContent
Returns the content of the result in form of anInputStream
with encodingStandardCharsets.UTF_8
. The actual interpretation of the content depends on the type as returned byTextResult.getTextContentType()
.- Specified by:
getTextContent
in interfaceTextResult
- Returns:
- the content as
String
- Throws:
IOException
- thrown if the content is created on demand and the creation failed
-
cleanup
When result-handling is finished, then this method is called to clean up used system resources, i.e. to delete a created file.This is also called if no appropriate
ResultAction
handled this Result.- Specified by:
cleanup
in interfaceResult
- Throws:
IOException
-
getTextContentType
Get the MIME type this result has.- Specified by:
getTextContentType
in interfaceTextResult
- Returns:
- the content type of this result. When
null
, 'text/plain' is to be used. - Throws:
Exception
- if the type is could not be determined due to an IO problem
-
getText
Returns the content of the result in form of aString
. The actual interpretation of the content depends on the type as returned byTextResult.getTextContentType()
.- Specified by:
getText
in interfaceTextResult
- Returns:
- the content as
String
- Throws:
IOException
- thrown if the content is created on demand and the creation failed
-