com.dtolabs.rundeck.core.utils
Class PartialLineBuffer

java.lang.Object
  extended by com.dtolabs.rundeck.core.utils.PartialLineBuffer

public class PartialLineBuffer
extends java.lang.Object

A Line oriented String buffer which can also return the last incomplete line read


Constructor Summary
PartialLineBuffer()
           
 
Method Summary
 void addData(char[] data, int off, int size)
          Add character data to the buffer
 void clearPartial()
          Clear the partial fragment string
 java.util.List<java.lang.String> getLines()
          Return the line buffer
 java.lang.String getPartialLine()
          Return the last partial line read and mark it
 java.lang.String getPartialLine(boolean mark)
          Return the last partial line read, optionally marking it as already read.
 int read(java.io.Reader reader)
          Read some chars from a reader, and return the number of characters read
 java.lang.String readLine()
          Read the next line if any, and remove it from the buffer.
 void unmarkPartial()
          Unmark any partial line so it can be read again
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartialLineBuffer

public PartialLineBuffer()
Method Detail

read

public int read(java.io.Reader reader)
         throws java.io.IOException
Read 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


getPartialLine

public java.lang.String getPartialLine()
Return 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)
Return 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()
Read the next line if any, and remove it from the buffer.


getLines

public java.util.List<java.lang.String> getLines()
Return the line buffer