org.apache.tools.ant.taskdefs
Class FixCRLF
java.lang.Object
|
+--org.apache.tools.ant.Task
|
+--org.apache.tools.ant.taskdefs.MatchingTask
|
+--org.apache.tools.ant.taskdefs.FixCRLF
- public class FixCRLF
- extends MatchingTask
Task to convert text source files to local OS formatting conventions, as
well as repair text files damaged by misconfigured or misguided editors or
file transfer programs.
This task can take the following arguments:
- srcdir
- destdir
- include
- exclude
- cr
- tab
- eof
Of these arguments, only sourcedir is required.
When this task executes, it will scan the srcdir based on the include
and exclude properties.
Warning: do not run on binary or carefully formatted files.
this may sound obvious, but if you don't specify asis, presume that
your files are going to be modified. If you want tabs to be fixed,
whitespace characters may be added or removed as necessary. Similarly,
for CR's - in fact cr="add" can result in cr characters being removed.
(to handle cases where other programs have converted CRLF into CRCRLF).
- Author:
- Sam Ruby rubys@us.ibm.com
Constructor Summary |
FixCRLF()
Defaults the properties based on the system type. |
Method Summary |
void |
execute()
Executes the task. |
void |
setCr(java.lang.String option)
Specify how carriage return (CR) charaters are to be handled |
void |
setDestdir(java.lang.String destDirName)
Set the destination where the fixed files should be placed. |
void |
setEof(java.lang.String option)
Specify how DOS EOF (control-z) charaters are to be handled |
void |
setSrcdir(java.lang.String srcDirName)
Set the source dir to find the source text files. |
void |
setTab(java.lang.String option)
Specify how tab charaters are to be handled |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
FixCRLF
public FixCRLF()
- Defaults the properties based on the system type.
- Unix: cr="remove" tab="asis" eof="remove"
- DOS: cr="add" tab="asis" eof="asis"
setSrcdir
public void setSrcdir(java.lang.String srcDirName)
- Set the source dir to find the source text files.
- Parameters:
srcDirName
- name of the source directory.
setDestdir
public void setDestdir(java.lang.String destDirName)
- Set the destination where the fixed files should be placed.
Default is to replace the original file.
- Parameters:
destDirName
- name of the destination directory.
setCr
public void setCr(java.lang.String option)
- Specify how carriage return (CR) charaters are to be handled
- Parameters:
option
- valid values:
- add: ensure that there is a CR before every LF
- asis: leave CR characters alone
- remove: remove all CR characters
setTab
public void setTab(java.lang.String option)
- Specify how tab charaters are to be handled
- Parameters:
option
- valid values:
- add: convert sequences of spaces which span a tab stop to tabs
- asis: leave tab and space characters alone
- remove: convert tabs to spaces
setEof
public void setEof(java.lang.String option)
- Specify how DOS EOF (control-z) charaters are to be handled
- Parameters:
option
- valid values:
- add: ensure that there is an eof at the end of the file
- asis: leave eof characters alone
- remove: remove any eof character found at the end
execute
public void execute()
throws BuildException
- Executes the task.
- Overrides:
- execute in class Task
Copyright © 2000 Apache Software Foundation. All Rights Reserved.