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 TypeMethodDescriptionvoidcleanup()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 InputStreamReturns the content of the result in form of anInputStreamwith 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, waitMethods inherited from interface com.inet.taskplanner.server.api.result.Result
supportsFlavor, supportsOneFlavorOfMethods 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.TXTorMimeTypes.HTM- Since:
- taskplanner 3.0
-
-
Method Details
-
getTextContent
Returns the content of the result in form of anInputStreamwith encodingStandardCharsets.UTF_8. The actual interpretation of the content depends on the type as returned byTextResult.getTextContentType().- Specified by:
getTextContentin 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
ResultActionhandled this Result.- Specified by:
cleanupin interfaceResult- Throws:
IOException
-
getTextContentType
Get the MIME type this result has.- Specified by:
getTextContentTypein 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:
getTextin interfaceTextResult- Returns:
- the content as
String - Throws:
IOException- thrown if the content is created on demand and the creation failed
-