Package com.dtolabs.rundeck.core.utils
Class PartialLineBuffer
- java.lang.Object
-
- com.dtolabs.rundeck.core.utils.PartialLineBuffer
-
public class PartialLineBuffer extends java.lang.ObjectA Line oriented String buffer which can also return the last incomplete line read
-
-
Constructor Summary
Constructors Constructor Description PartialLineBuffer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddData(char[] data, int off, int size)Add character data to the buffervoidclearPartial()Clear the partial fragment stringjava.util.List<java.lang.String>getLines()java.lang.StringgetPartialLine()java.lang.StringgetPartialLine(boolean mark)intread(java.io.Reader reader)Read some chars from a reader, and return the number of characters readjava.lang.StringreadLine()voidunmarkPartial()Unmark any partial line so it can be read again
-
-
-
Method Detail
-
read
public int read(java.io.Reader reader) throws java.io.IOExceptionRead some chars from a reader, and return the number of characters read- Parameters:
reader- input reader- Returns:
- characters read
- Throws:
java.io.IOException- if thrown by underlying read action
-
addData
public void addData(char[] data, int off, int size)Add character data to the buffer- Parameters:
data- dataoff- offsetsize- length
-
getPartialLine
public java.lang.String getPartialLine()
- Returns:
- the last partial line read and mark it
-
unmarkPartial
public void unmarkPartial()
Unmark any partial line so it can be read again
-
clearPartial
public void clearPartial()
Clear the partial fragment string
-
getPartialLine
public java.lang.String getPartialLine(boolean mark)
- Parameters:
mark- true to mark it- Returns:
- the last partial line read, optionally marking it as already read. Subsequent calls with mark set to true will return null if there as been no new data.
-
readLine
public java.lang.String readLine()
- Returns:
- Read the next line if any, and remove it from the buffer.
-
getLines
public java.util.List<java.lang.String> getLines()
- Returns:
- the line buffer
-
-