1 | public void setLines(final long lines) {↵ | | 1 | public void setLines(final long lines) {↵
|
2 | this.lines = lines;↵ | | 2 | this.lines = lines;↵
|
3 | }↵ | | 3 | }↵
|
|
4 | /**↵ | | 4 | /**↵
|
5 | * Returns the number of lines to be returned in the filtered stream.↵ | | 5 | * Returns the number of lines to be returned in the filtered stream.↵
|
6 | *↵ | | 6 | *↵
|
7 | * @return the number of lines to be returned in the filtered stream↵ | | 7 | * @return the number of lines to be returned in the filtered stream↵
|
8 | */↵ | | 8 | */↵
|
9 | private long getLines() {↵ | | 9 | private long getLines() {↵
|
10 | return lines;↵ | | 10 | return lines;↵
|
11 | }↵ | | 11 | }↵
|
|
12 | /**↵ | | 12 | /**↵
|
13 | * Sets the number of lines to be skipped in the filtered stream.↵ | | 13 | * Sets the number of lines to be skipped in the filtered stream.↵
|
14 | *↵ | | 14 | *↵
|
15 | * @param skip the number of lines to be skipped in the filtered stream↵ | | 15 | * @param skip the number of lines to be skipped in the filtered stream↵
|
16 | */↵ | | 16 | */↵
|
17 | public void setSkip(final long skip) {↵ | | 17 | public void setSkip(final long skip) {↵
|
18 | this.skip = skip;↵ | | 18 | this.skip = skip;↵
|
19 | }↵ | | 19 | }↵
|
|
20 | /**↵ | | 20 | /**↵
|
21 | * Returns the number of lines to be skipped in the filtered stream.↵ | | 21 | * Returns the number of lines to be skipped in the filtered stream.↵
|
22 | *↵ | | 22 | *↵
|
23 | * @return the number of lines to be skipped in the filtered stream↵ | | 23 | * @return the number of lines to be skipped in the filtered stream↵
|
24 | */↵ | | 24 | */↵
|
25 | private long getSkip() {↵ | | 25 | private long getSkip() {↵
|
26 | return skip;↵ | | 26 | return skip;↵
|
27 | }↵ | | 27 | }↵
|
|
28 | /**↵ | | 28 | /**↵
|
29 | * Creates a new HeadFilter using the passed in↵ | | 29 | * Creates a new TailFilter using the passed in↵
|
30 | * Reader for instantiation.↵ | | 30 | * Reader for instantiation.↵
|
31 | *↵ | | 31 | *↵
|
32 | * @param rdr A Reader object providing the underlying stream.↵ | | 32 | * @param rdr A Reader object providing the underlying stream.↵
|
33 | * Must not be <code>null</code>.↵ | | 33 | * Must not be <code>null</code>.↵
|
34 | *↵ | | 34 | *↵
|
35 | * @return a new filter based on this configuration, but filtering↵ | | 35 | * @return a new filter based on this configuration, but filtering↵
|
36 | * the specified reader↵ | | 36 | * the specified reader↵
|
37 | */↵ | | 37 | */↵
|
38 | public Reader chain(final Reader rdr) {↵ | | 38 | public Reader chain(final Reader rdr) {↵
|
39 | HeadFilter newFilter = new HeadFilter(rdr);↵ | | 39 | TailFilter newFilter = new TailFilter(rdr);↵
|
40 | newFilter.setLines(getLines());↵ | | 40 | newFilter.setLines(getLines());↵
|
41 | newFilter.setSkip(getSkip());↵ | | 41 | newFilter.setSkip(getSkip());↵
|
42 | newFilter.setInitialized(true);↵ | | 42 | newFilter.setInitialized(true);↵
|
43 | return newFilter | | 43 | return newFilter
|