Class StringTextResult
java.lang.Object
com.inet.taskplanner.server.api.result.StringTextResult
- All Implemented Interfaces:
Result, TextResult
A result that contains human-readable text.
- Since:
- taskplanner 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionStringTextResult(String text, String contentType) Creates a new StringTextResult instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Releases resources held by this result.getText()Returns the content of the result in the form of aString.@Nonnull InputStreamReturns a new UTF-8 encoded input stream containing this result's text.Get the MIME type this result has.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Result
supportsFlavor, supportsOneFlavorOfMethods inherited from interface TextResult
getFlavors
-
Constructor Details
-
StringTextResult
-
-
Method Details
-
getTextContent
Returns a new UTF-8 encoded input stream containing this result's text. Each invocation creates an independent stream positioned at the beginning of the text.- Specified by:
getTextContentin interfaceTextResult- Returns:
- the text content as a UTF-8 input stream.
- Throws:
IOException- if the input stream cannot be created- Since:
- taskplanner 3.0
-
cleanup
Releases resources held by this result. Because this result stores its content in memory, there are no resources to release and this method does nothing.- Specified by:
cleanupin interfaceResult- Throws:
IOException- if an error occurs while releasing resources- Since:
- taskplanner 3.0
-
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 could not be determined due to an IO problem
-
getText
Returns the content of the result in the 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 a
String - Throws:
IOException- thrown if the content is created on demand and the creation failed
-