ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Haas" <>
Subject Proposal: File translation task
Date Tue, 18 Apr 2000 22:08:56 GMT
Hi all

In our prject we needed to add some file processing (striping off headers and footers of text
files). The current copyfile does similar things. Functionality is spread across Project and
Copyfile. I feel translating or generally processing and copying files should be separated.
For me copying is copying withjout ANY modifications applied.

Translate extends MatchingTask and currently supports therefor (probably) all MatchingTask

The attached proposal allows the following definitions in your build.xml:
<translate src="/from/dir" dest="/to/dir">
    <include .../>
    <exclude .../>
    <strip header="HEADER-SEPARATOR" footer="FOOTER-SEPARATOR"/>
    <convertCRLF format="DOS"/>

- This is the third implementation of CRLF conversion. This has been done, as the others can
not be combined with other file translation.
- Adding token filtering is no big deal (note the current token filtering may converts your
- Add your own file translation as you need it.
- the strip shown aboev only prints text between HEADER-SEPARATOR and FOOTER-SEPARATOR or
end of file.

How it works:
The translation is done by objects extending FilterOutputStream. For each file to be translated,
the FilterOutputStreams are chainned together. The example above results in a chain of:
StripFilterOutputStream ---> ConvertCRLFFilterOutputStream ---> FileOutputStream

Next step:
- If considered a good thing, a real patch will be provided, including the token filtering.
- strip may not be part of standard distribution

- tom

View raw message