org.apache.tools.ant.taskdefs
public class FixCRLF extends MatchingTask
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 (which I suspect is the standard on Macs.) 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.
Since: Ant 1.1
UNKNOWN: category="filesystem"
Nested Class Summary | |
---|---|
static class | FixCRLF.AddAsisRemove
Enumerated attribute with the values "asis", "add" and "remove". |
static class | FixCRLF.CrLf
Enumerated attribute with the values "asis", "cr", "lf" and "crlf". |
Constructor Summary | |
---|---|
FixCRLF()
Defaults the properties based on the system type.
|
Method Summary | |
---|---|
void | execute()
Executes the task. |
void | setCr(FixCRLF.AddAsisRemove attr)
Specify how carriage return (CR) characters are to be handled.
|
void | setDestdir(File destDir)
Set the destination where the fixed files should be placed.
|
void | setEncoding(String encoding)
Specifies the encoding Ant expects the files to be in -
defaults to the platforms default encoding. |
void | setEof(FixCRLF.AddAsisRemove attr)
Specify how DOS EOF (control-z) characters are to be handled.
|
void | setEol(FixCRLF.CrLf attr)
Specify how EndOfLine characters are to be handled.
|
void | setFixlast(boolean fixlast)
Specify whether a missing EOL will be added
to the final line of a file. |
void | setJavafiles(boolean javafiles)
Set to true if modifying Java source files. |
void | setSrcdir(File srcDir)
Set the source dir to find the source text files. |
void | setTab(FixCRLF.AddAsisRemove attr)
Specify how tab characters are to be handled.
|
void | setTablength(int tlength)
Specify tab length in characters.
|
Deprecated: use {@link #setEol setEol} instead.
Specify how carriage return (CR) characters are to be handled.Parameters: attr valid values:
Parameters: attr valid values:
Parameters: attr valid values:
Parameters: attr valid values:
Parameters: tlength specify the length of tab in spaces,