n
lines of a stream. (Default is last10 lines.)
Example:
<tailfilter lines="3"/>Or:
<filterreader classname="org.apache.tools.ant.filters.TailFilter"> <param name="lines" value="3"/> </filterreader>
Modifier and Type | Field and Description |
---|---|
private boolean | completedReadAhead
Whether or not read-ahead been completed. |
private static final int | DEFAULT_NUM_LINES
Default number of lines to show |
private String | line
the current line from the input stream |
private LinkedList | |
private int | linePos
the position in the current line |
private long | lines
Number of lines to be returned in the filtered stream. |
private static final String | LINES_KEY
Parameter name for the number of lines to be returned. |
private LineTokenizer | lineTokenizer
A line tokenizer |
private long | skip
Number of lines to be skipped. |
private static final String | SKIP_KEY
Parameter name for the number of lines to be skipped. |
Access | Constructor and Description |
---|---|
public | |
public | TailFilter(final Reader
A Reader object providing the underlying stream.
Must not be in)null .Creates a new filtered reader. |
Modifier and Type | Method and Description |
---|---|
public Reader | Returns: a new filter based on this configuration, but filtering the specified readerA Reader object providing the underlying stream.
Must not be rdr)null .Implements org. |
private long | Returns: the number of lines to be returned in the filtered streamReturns the number of lines to be returned in the filtered stream. |
private long | Returns: the number of lines to be skipped in the filtered streamReturns the number of lines to be skipped in the filtered stream. |
private void | initialize()
Scans the parameters list for the "lines" parameter and uses it to set the number of lines to be returned in the filtered stream. |
public int | Returns: the next character in the resulting stream, or -1 if the end of the resulting stream has been reachedOverrides java. |
public void | setLines(final long
the number of lines to be returned in the filtered stream lines)Sets the number of lines to be returned in the filtered stream. |
public void | setSkip(final long
the number of lines to be skipped in the filtered stream skip)Sets the number of lines to be skipped in the filtered stream. |
private String | Returns: "" while reading in the lines, line while outputting the lines null at the end of outputting the linesimplement a tail filter on a stream of lines. |
completedReadAhead | back to summary |
---|---|
private boolean completedReadAhead Whether or not read-ahead been completed. |
DEFAULT_NUM_LINES | back to summary |
---|---|
private static final int DEFAULT_NUM_LINES Default number of lines to show |
line | back to summary |
---|---|
private String line the current line from the input stream |
lineList | back to summary |
---|---|
private LinkedList<String> lineList |
linePos | back to summary |
---|---|
private int linePos the position in the current line |
lines | back to summary |
---|---|
private long lines Number of lines to be returned in the filtered stream. |
LINES_KEY | back to summary |
---|---|
private static final String LINES_KEY Parameter name for the number of lines to be returned. |
lineTokenizer | back to summary |
---|---|
private LineTokenizer lineTokenizer A line tokenizer |
skip | back to summary |
---|---|
private long skip Number of lines to be skipped. |
SKIP_KEY | back to summary |
---|---|
private static final String SKIP_KEY Parameter name for the number of lines to be skipped. |
TailFilter | back to summary |
---|---|
public TailFilter() Constructor for "dummy" instances.
|
TailFilter | back to summary |
---|---|
public TailFilter(final Reader in) Creates a new filtered reader.
|
chain | back to summary |
---|---|
public Reader chain(final Reader rdr) Implements org. Creates a new TailFilter using the passed in Reader for instantiation. |
getLines | back to summary |
---|---|
private long getLines() Returns the number of lines to be returned in the filtered stream.
|
getSkip | back to summary |
---|---|
private long getSkip() Returns the number of lines to be skipped in the filtered stream.
|
initialize | back to summary |
---|---|
private void initialize() Scans the parameters list for the "lines" parameter and uses it to set the number of lines to be returned in the filtered stream. also scan for "skip" parameter. |
read | back to summary |
---|---|
public int read() throws IOException Overrides java. Returns the next character in the filtered stream. If the read-ahead has been completed, the next character in the buffer is returned. Otherwise, the stream is read to the end and buffered (with the buffer growing as necessary), then the appropriate position in the buffer is set to read from.
|
setLines | back to summary |
---|---|
public void setLines(final long lines) Sets the number of lines to be returned in the filtered stream.
|
setSkip | back to summary |
---|---|
public void setSkip(final long skip) Sets the number of lines to be skipped in the filtered stream.
|
tailFilter | back to summary |
---|---|
private String tailFilter(String line) implement a tail filter on a stream of lines. line = null is the end of the stream.
|