This task can take the following arguments:
When this task executes, it will scan the srcdir based on the include and exclude properties.
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 will leave untouched any literal TAB characters embedded within string or character constants.
Warning
do not run on binary files. 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 CR's - in fact "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.
| Modifier and Type | Class and Description |
|---|---|
| public static class | FixCRLF.AddAsisRemove
Enumerated attribute with the values "asis", "add" and "remove". |
| public static class | FixCRLF.CrLf
Enumerated attribute with the values "asis", "cr", "lf", "crlf", "mac", "unix" and "dos. |
| protected class | FixCRLF.OneLiner
Deprecated
since 1.7.0.
Deprecated, the functionality has been moved to filters.FixCrLfFilter.
|
| Modifier and Type | Field and Description |
|---|---|
| private File | |
| private String | encoding
Encoding to assume for the files |
| public static final String | ERROR_FILE_AND_SRCDIR
error string for using srcdir and file |
| private Vector | |
| private File | |
| private static final FileUtils | |
| private FixCrLfFilter | |
| private static final String | |
| private String | outputEncoding
Encoding to use for output files |
| private boolean | |
| private File |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final Reader | Returns: a Reader.Reader to chain. rdr)Implements org. |
| public void | |
| private void | |
| public void | setCr(FixCRLF.
valid values:
attr
Deprecated
since 1.4.x.
Use
Specify how carriage return (CR) characters are to be handled.
setEol instead.
|
| public void | setDestdir(File
the destination directory. destDir)Set the destination where the fixed files should be placed. |
| public void | setEncoding(String
String encoding name. encoding)Specifies the encoding Ant expects the files to be in--defaults to the platforms default encoding. |
| public void | setEof(FixCRLF.
valid values:
attr
Specify how DOS EOF (control-z) characters are to be handled. |
| public void | |
| public void | |
| public void | setFixlast(boolean
whether to fix the last line. fixlast)Specify whether a missing EOL will be added to the final line of a file. |
| public void | setJavafiles(boolean
whether modifying Java files. javafiles)Set to true if modifying Java source files. |
| public void | setOutputEncoding(String
String outputEncoding name. outputEncoding)Specifies the encoding that the files are to be written in--same as input encoding by default. |
| public void | setPreserveLastModified(boolean
true if timestamps should be preserved. preserve)Set whether to preserve the last modified time as the original files. |
| public void | |
| public void | setTab(FixCRLF.
valid values:
attr
Specify how tab characters are to be handled. |
| public void | |
| private void |
| destDir | back to summary |
|---|---|
| private File destDir | |
| encoding | back to summary |
|---|---|
| private String encoding Encoding to assume for the files | |
| ERROR_FILE_AND_SRCDIR | back to summary |
|---|---|
| public static final String ERROR_FILE_AND_SRCDIR error string for using srcdir and file | |
| fcv | back to summary |
|---|---|
| private Vector<FilterChain> fcv | |
| file | back to summary |
|---|---|
| private File file | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS | |
| filter | back to summary |
|---|---|
| private FixCrLfFilter filter | |
| FIXCRLF_ERROR | back to summary |
|---|---|
| private static final String FIXCRLF_ERROR | |
| outputEncoding | back to summary |
|---|---|
| private String outputEncoding Encoding to use for output files | |
| preserveLastModified | back to summary |
|---|---|
| private boolean preserveLastModified | |
| srcDir | back to summary |
|---|---|
| private File srcDir | |
| FixCRLF | back to summary |
|---|---|
| public FixCRLF() | |
| chain | back to summary |
|---|---|
| public final Reader chain(final Reader rdr) Implements org. Chain this task as a reader. | |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. Executes the task.
| |
| processFile | back to summary |
|---|---|
| private void processFile(String file) throws BuildException | |
| setCr | back to summary |
|---|---|
| public void setCr(FixCRLF. Deprecated since 1.4.x.
Use Specify how carriage return (CR) characters are to be handled.
| |
| setDestdir | back to summary |
|---|---|
| public void setDestdir(File destDir) Set the destination where the fixed files should be placed. Default is to replace the original file.
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) Specifies the encoding Ant expects the files to be in--defaults to the platforms default encoding.
| |
| setEof | back to summary |
|---|---|
| public void setEof(FixCRLF. Specify how DOS EOF (control-z) characters are to be handled.
| |
| setEol | back to summary |
|---|---|
| public void setEol(FixCRLF. Specify how EndOfLine characters are to be handled. | |
| setFile | back to summary |
|---|---|
| public void setFile(File file) Set a single file to convert.
| |
| setFixlast | back to summary |
|---|---|
| public void setFixlast(boolean fixlast) Specify whether a missing EOL will be added to the final line of a file.
| |
| setJavafiles | back to summary |
|---|---|
| public void setJavafiles(boolean javafiles) Set to true if modifying Java source files.
| |
| setOutputEncoding | back to summary |
|---|---|
| public void setOutputEncoding(String outputEncoding) Specifies the encoding that the files are to be written in--same as input encoding by default.
| |
| setPreserveLastModified | back to summary |
|---|---|
| public void setPreserveLastModified(boolean preserve) Set whether to preserve the last modified time as the original files.
| |
| setSrcdir | back to summary |
|---|---|
| public void setSrcdir(File srcDir) Set the source dir to find the source text files.
| |
| setTab | back to summary |
|---|---|
| public void setTab(FixCRLF. Specify how tab characters are to be handled.
| |
| setTablength | back to summary |
|---|---|
| public void setTablength(int tlength) throws BuildException Specify tab length in characters.
| |
| validate | back to summary |
|---|---|
| private void validate() throws BuildException | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | getValues()
Implements abstract org. |
| AddAsisRemove | back to summary |
|---|---|
| public AddAsisRemove() | |
| getValues | back to summary |
|---|---|
| public String[] getValues() Implements abstract org. Doc from org. This is the only method a subclass needs to implement.. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | getValues()
Implements abstract org. |
| CrLf | back to summary |
|---|---|
| public CrLf() | |
| getValues | back to summary |
|---|---|
| public String[] getValues() Implements abstract org. Doc from org. This is the only method a subclass needs to implement. | |
Deprecated
since 1.7.0.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private static final char | |
| private StringBuffer | |
| private StringBuffer | |
| private static final int | |
| private StringBuffer | |
| private static final int | |
| private static final int | |
| private static final int | |
| private boolean | |
| private BufferedReader | |
| private File | |
| private int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String | |
| public int | |
| public boolean | Returns: true if there is more elements.Implements java. |
| public Object | Returns: the next element.Implements java. |
| protected void | |
| public void |
| CTRLZ | back to summary |
|---|---|
| private static final char CTRLZ | |
| eofStr | back to summary |
|---|---|
| private StringBuffer eofStr | |
| eolStr | back to summary |
|---|---|
| private StringBuffer eolStr | |
| INBUFLEN | back to summary |
|---|---|
| private static final int INBUFLEN | |
| line | back to summary |
|---|---|
| private StringBuffer line | |
| LINEBUFLEN | back to summary |
|---|---|
| private static final int LINEBUFLEN | |
| LOOKING | back to summary |
|---|---|
| private static final int LOOKING | |
| NOTJAVA | back to summary |
|---|---|
| private static final int NOTJAVA | |
| reachedEof | back to summary |
|---|---|
| private boolean reachedEof | |
| reader | back to summary |
|---|---|
| private BufferedReader reader | |
| srcFile | back to summary |
|---|---|
| private File srcFile | |
| state | back to summary |
|---|---|
| private int state | |
| UNDEF | back to summary |
|---|---|
| private static final int UNDEF | |
| OneLiner | back to summary |
|---|---|
| public OneLiner(File srcFile) throws BuildException Constructor.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Close the reader.
| |
| getEofStr | back to summary |
|---|---|
| public String getEofStr() get the eof string.
| |
| getState | back to summary |
|---|---|
| public int getState() get the state.
| |
| hasMoreElements | back to summary |
|---|---|
| public boolean hasMoreElements() Implements java. Doc from java. Tests if this enumeration contains more elements.
| |
| nextElement | back to summary |
|---|---|
| public Object nextElement() throws NoSuchElementException Implements java. get the next element.
| |
| nextLine | back to summary |
|---|---|
| protected void nextLine() throws BuildException Move to the next line.
| |
| setState | back to summary |
|---|---|
| public void setState(int state) Set the state.
| |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private String | |
| private String | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public char | |
| public int | |
| public String | |
| public int | |
| public String | |
| public int | |
| public int | |
| public char | |
| public char | |
| public int | |
| public int | |
| public int | |
| public void | |
| public void | |
| public void | |
| public void | |
| public String | |
| public String |
| column | back to summary |
|---|---|
| private int column | |
| eolStr | back to summary |
|---|---|
| private String eolStr | |
| line | back to summary |
|---|---|
| private String line | |
| lookahead | back to summary |
|---|---|
| private int lookahead | |
| next | back to summary |
|---|---|
| private int next | |
| BufferLine | back to summary |
|---|---|
| public BufferLine(String line, String eolStr) throws BuildException | |
| getChar | back to summary |
|---|---|
| public char getChar(int i) | |
| getColumn | back to summary |
|---|---|
| public int getColumn() | |
| getEol | back to summary |
|---|---|
| public String getEol() | |
| getEolLength | back to summary |
|---|---|
| public int getEolLength() | |
| getLineString | back to summary |
|---|---|
| public String getLineString() | |
| getLookahead | back to summary |
|---|---|
| public int getLookahead() | |
| getNext | back to summary |
|---|---|
| public int getNext() | |
| getNextChar | back to summary |
|---|---|
| public char getNextChar() | |
| getNextCharInc | back to summary |
|---|---|
| public char getNextCharInc() | |
| getState | back to summary |
|---|---|
| public int getState() | |
| incColumn | back to summary |
|---|---|
| public int incColumn() | |
| length | back to summary |
|---|---|
| public int length() | |
| setColumn | back to summary |
|---|---|
| public void setColumn(int col) | |
| setLookahead | back to summary |
|---|---|
| public void setLookahead(int lookahead) | |
| setNext | back to summary |
|---|---|
| public void setNext(int next) | |
| setState | back to summary |
|---|---|
| public void setState(int state) | |
| substring | back to summary |
|---|---|
| public String substring(int begin) | |
| substring | back to summary |
|---|---|
| public String substring(int begin, int end) | |