Browse Source

should speed this filter somewhat

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@558886 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
e2b773ab24
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/main/org/apache/tools/ant/filters/HeadFilter.java

+ 7
- 0
src/main/org/apache/tools/ant/filters/HeadFilter.java View File

@@ -62,6 +62,9 @@ public final class HeadFilter extends BaseParamFilterReader
/** the position in the current line */ /** the position in the current line */
private int linePos = 0; private int linePos = 0;


/** Whether this filter is finished */
private boolean eof;

/** /**
* Constructor for "dummy" instances. * Constructor for "dummy" instances.
* *
@@ -107,6 +110,9 @@ public final class HeadFilter extends BaseParamFilterReader
return -1; return -1;
} }
line = headFilter(line); line = headFilter(line);
if (eof) {
return -1;
}
linePos = 0; linePos = 0;
} }


@@ -206,6 +212,7 @@ public final class HeadFilter extends BaseParamFilterReader


if (lines > 0) { if (lines > 0) {
if (linesRead > (lines + skip)) { if (linesRead > (lines + skip)) {
eof = true;
return null; return null;
} }
} }


Loading…
Cancel
Save