This filter can take the following arguments:
This version generalises the handling of EOL characters, and allows for CR-only line endings (the standard on Mac systems prior to OS X). Tab handling has also been generalised to accommodate any tabwidth from 2 to 80, inclusive. Importantly, it can leave untouched any literal TAB characters embedded within Java string or character constants.
Caution: run with care on carefully formatted files. This may sound obvious, but if you don't specify asis, presume that your files are going to be modified. If "tabs" is "add" or "remove", whitespace characters may be added or removed as necessary. Similarly, for EOLs, eol="asis" actually means convert to your native O/S EOL convention while eol="crlf" or cr="add" can result in CR characters being removed in one special case accommodated, i.e., CRCRLF is regarded as a single EOL to handle cases where other programs have converted CRLF into CRCRLF.
Example:
<<fixcrlf tab="add" eol="crlf" eof="asis"/>Or:
<filterreader classname="org.apache.tools.ant.filters.FixCrLfFilter"> <param eol="crlf" tab="asis"/> </filterreader>
| Modifier and Type | Class and Description |
|---|---|
| public static class | FixCrLfFilter.AddAsisRemove
Enumerated attribute with the values "asis", "add" and "remove". |
| private static class | |
| private static class | |
| public static class | FixCrLfFilter.CrLf
Enumerated attribute with the values "asis", "cr", "lf" and "crlf". |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | FixCrLfFilter.SimpleFilterReader
This filter reader redirects all read I/O methods through its own read() method. |
| Modifier and Type | Field and Description |
|---|---|
| private static final char | |
| private FixCrLfFilter. | |
| private static final int | |
| private FixCrLfFilter. | |
| private boolean | |
| private boolean | |
| private boolean | |
| private static final int | |
| private static final int | |
| private int | |
| private FixCrLfFilter. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | FixCrLfFilter(final Reader
A Reader object providing the underlying stream. Must not be
in)null.Create a new filtered reader. |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| public Reader | Returns: a new filter based on this configuration, but filtering the specified reader.A Reader object providing the underlying stream. Must not be
rdr)null.Implements org. |
| public FixCrLfFilter. | Returns: values:
Get how DOS EOF (control-z) characters are being handled. |
| public FixCrLfFilter. | Returns: values:
Get how EndOfLine characters are being handled. |
| public boolean | Returns: true if a filtered file will always end with an EOLGet whether a missing EOL be added to the final line of the stream. |
| public boolean | Returns: true if whitespace in Java character and string literals is ignored.Get whether the stream is to be treated as though it contains Java source. |
| public FixCrLfFilter. | Returns: values:
Return how tab characters are being handled. |
| public int | |
| private void | initInternalFilters()
Wrap the input stream with the internal filters necessary to perform the configuration settings. |
| public synchronized int | Returns: the next character in the resulting stream, or -1 if the end of the resulting stream has been reached.Overrides java. |
| public void | setEof(FixCrLfFilter.
valid values:
attr
Specify how DOS EOF (control-z) characters are to be handled. |
| public void | setEol(FixCrLfFilter.
valid values:
attr
Specify how end of line (EOL) characters are to be handled. |
| public void | setFixlast(boolean
if true a missing EOL will be appended. fixlast)Specify whether a missing EOL will be added to the final line of input. |
| public void | setJavafiles(boolean
set to true to prevent this filter from changing tabs found in
Java literals. javafiles)Indicate whether this stream contains Java source. |
| public void | setTab(FixCrLfFilter.
valid values:
attr
Specify how tab characters are to be handled. |
| public void | setTablength(int
specify the length of tab in spaces. Valid values are between
2 and 80 inclusive. The default for this parameter is 8. tabLength)Specify tab length in characters. |