Class StringTextResult
- java.lang.Object
-
- com.inet.taskplanner.server.api.result.StringTextResult
-
- All Implemented Interfaces:
Result,TextResult
public class StringTextResult extends java.lang.Object implements TextResult
A Result which contains of human readable text.- Since:
- taskplanner 3.0
-
-
Constructor Summary
Constructors Constructor Description StringTextResult(java.lang.String text, java.lang.String contentType)Creates a new TextResult instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()When result-handling is finished, then this method is called to clean up used system resources, i.e.java.lang.StringgetText()Returns the content of the result in form of aString.java.io.InputStreamgetTextContent()Returns the content of the result in form of anInputStreamwith encodingStandardCharsets.UTF_8.java.lang.StringgetTextContentType()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
-
-
-
-
Method Detail
-
getTextContent
@Nonnull public java.io.InputStream getTextContent() throws java.io.IOExceptionReturns 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:
java.io.IOException- thrown if the content is created on demand and the creation failed
-
cleanup
public void cleanup() throws java.io.IOExceptionWhen 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.
-
getTextContentType
public java.lang.String getTextContentType() throws java.lang.ExceptionGet 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:
java.lang.Exception- if the type is could not be determined due to an IO problem
-
getText
public java.lang.String getText() throws java.io.IOExceptionReturns 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:
java.io.IOException- thrown if the content is created on demand and the creation failed
-
-