Methods Summary |
---|
public java.io.Reader | chain(java.io.Reader rdr)Creates a new TabsToSpaces using the passed in
Reader for instantiation.
TabsToSpaces newFilter = new TabsToSpaces(rdr);
newFilter.setTablength(getTablength());
newFilter.setInitialized(true);
return newFilter;
|
private int | getTablength()Returns the tab length.
return tabLength;
|
private void | initialize()Parses the parameters to set the tab length.
Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (params[i] != null) {
if (TAB_LENGTH_KEY.equals(params[i].getName())) {
tabLength =
new Integer(params[i].getValue()).intValue();
break;
}
}
}
}
|
public int | read()Returns the next character in the filtered stream, converting tabs
to the specified number of spaces.
if (!getInitialized()) {
initialize();
setInitialized(true);
}
int ch = -1;
if (spacesRemaining > 0) {
spacesRemaining--;
ch = ' ";
} else {
ch = in.read();
if (ch == '\t") {
spacesRemaining = tabLength - 1;
ch = ' ";
}
}
return ch;
|
public void | setTablength(int tabLength)Sets the tab length.
this.tabLength = tabLength;
|