Methods Summary |
---|
public java.io.Reader | chain(java.io.Reader rdr)Creates a new StripLineBreaks using the passed in
Reader for instantiation.
StripLineBreaks newFilter = new StripLineBreaks(rdr);
newFilter.setLineBreaks(getLineBreaks());
newFilter.setInitialized(true);
return newFilter;
|
private java.lang.String | getLineBreaks()Returns the line-breaking characters as a String.
return lineBreaks;
|
private void | initialize()Parses the parameters to set the line-breaking characters.
String userDefinedLineBreaks = null;
Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (LINE_BREAKS_KEY.equals(params[i].getName())) {
userDefinedLineBreaks = params[i].getValue();
break;
}
}
}
if (userDefinedLineBreaks != null) {
lineBreaks = userDefinedLineBreaks;
}
|
public int | read()Returns the next character in the filtered stream, only including
characters not in the set of line-breaking characters.
if (!getInitialized()) {
initialize();
setInitialized(true);
}
int ch = in.read();
while (ch != -1) {
if (lineBreaks.indexOf(ch) == -1) {
break;
} else {
ch = in.read();
}
}
return ch;
|
public void | setLineBreaks(java.lang.String lineBreaks)Sets the line-breaking characters.
this.lineBreaks = lineBreaks;
|