Class StringDrain
java.lang.Object
de.hybris.platform.mediaconversion.os.process.StringDrain
- All Implemented Interfaces:
Drain
Drain implementation gathering all output in a StringBuffer.
The result string can be accessed through the toString() method.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newStringDrainwhich will append/reconstruct newlines.StringDrain(boolean appendNewlines) Creates a newStringDrainwhich optionally appends newline to each processed line. -
Method Summary
Modifier and TypeMethodDescriptionvoidCallback method to process a line outputted by the process.booleanAccesses whether newline characters are appended to each consumed line.toString()Accesses the current contents of thisStringDrain.
-
Constructor Details
-
StringDrain
public StringDrain()Constructs a newStringDrainwhich will append/reconstruct newlines. -
StringDrain
public StringDrain(boolean appendNewlines) Creates a newStringDrainwhich optionally appends newline to each processed line.- Parameters:
appendNewlines- whether newlines (\n) should be appended to each line, this would reconstruct the original contents of the output.
-
-
Method Details
-
drain
Callback method to process a line outputted by the process. A trailing newline character is truncated. -
isAppendingNewlines
public boolean isAppendingNewlines()Accesses whether newline characters are appended to each consumed line.- Returns:
- the appendNewlines flag as specified on construction time.
-
toString
Accesses the current contents of thisStringDrain.- Overrides:
toStringin classObject- Returns:
- the current contents of the underlying
StringBuffer, i.e. all data forwarded to thisDrainyet. - See Also:
-