Class StringDrain
- java.lang.Object
-
- de.hybris.platform.mediaconversion.os.process.StringDrain
-
- All Implemented Interfaces:
Drain
public class StringDrain extends java.lang.Object implements Drain
Drainimplementation gathering all output in aStringBuffer.The result string can be accessed through the
toString()method.
-
-
Constructor Summary
Constructors Constructor Description StringDrain()Constructs a newStringDrainwhich will append/reconstruct newlines.StringDrain(boolean appendNewlines)Creates a newStringDrainwhich optionally appends newline to each processed line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrain(java.lang.String line)Callback method to process a line outputted by the process.booleanisAppendingNewlines()Accesses whether newline characters are appended to each consumed line.java.lang.StringtoString()Accesses the current contents of thisStringDrain.
-
-
-
Constructor Detail
-
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 Detail
-
drain
public void drain(java.lang.String line)
Callback method to process a line outputted by the process. A trailing newline character is truncated.- Specified by:
drainin interfaceDrain- Parameters:
line- the output line to process.- See Also:
Drain.drain(String)
-
isAppendingNewlines
public boolean isAppendingNewlines()
Accesses whether newline characters are appended to each consumed line.- Returns:
- the appendNewlines flag as specified on construction time.
-
toString
public java.lang.String toString()
Accesses the current contents of thisStringDrain.- Overrides:
toStringin classjava.lang.Object- Returns:
- the current contents of the underlying
StringBuffer, i.e. all data forwarded to thisDrainyet. - See Also:
Object.toString()
-
-