1 | <html>
|
---|
2 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
3 | <head><title>Native2Ascii Task</title></head>
|
---|
4 | <body>
|
---|
5 | <h2>Native2Ascii</h2>
|
---|
6 |
|
---|
7 | <h3>Description:</h3>
|
---|
8 |
|
---|
9 | <p>
|
---|
10 | Converts files from native encodings to ASCII with escaped Unicode.
|
---|
11 | A common usage is to convert source files maintained in a native
|
---|
12 | operating system encoding, to ASCII prior to compilation.
|
---|
13 | </p>
|
---|
14 |
|
---|
15 | <p>
|
---|
16 | Files in the directory <em>src</em>
|
---|
17 | are converted from a native encoding to ASCII.
|
---|
18 | By default, all files in the directory are converted.
|
---|
19 | However, conversion may be limited to selected files using
|
---|
20 | <em>includes</em> and <em>excludes</em> attributes.
|
---|
21 | For more information on file matching patterns,
|
---|
22 | see the section on
|
---|
23 | <a href="../dirtasks.html#directorybasedtasks">directory based tasks</a>.
|
---|
24 | If no <em>encoding</em> is specified,
|
---|
25 | the default encoding for the JVM is used.
|
---|
26 | If <em>ext</em> is specified, then output files are renamed
|
---|
27 | to use it as a new extension.
|
---|
28 | More sophisticated file name translations can be achieved using a nested
|
---|
29 | <em><code><mapper></code></em> element. By default an
|
---|
30 | <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a> will be used.
|
---|
31 | If <em>dest</em> and <em>src</em> point to the same directory,
|
---|
32 | the <em>ext</em> attribute or a nested <em><code><mapper></code></em>
|
---|
33 | is required.
|
---|
34 | </p>
|
---|
35 |
|
---|
36 | <p>
|
---|
37 | This task forms an implicit <a href="../CoreTypes/fileset.html">File Set</a>,
|
---|
38 | and supports all attributes of <code><fileset></code>
|
---|
39 | (<code>dir</code> becomes <code>src</code>) as well as
|
---|
40 | nested <code><include></code>, <code><exclude></code>,
|
---|
41 | and <code><patternset></code> elements.
|
---|
42 | </p>
|
---|
43 |
|
---|
44 | <p>It is possible to use different converters. This can be selected
|
---|
45 | with the <code>implementation</code> attribute.
|
---|
46 | <a name="implementationvalues">Here are the choices</a>:</p>
|
---|
47 | <ul>
|
---|
48 | <li>default - the default converter (kaffe or sun) for the platform.</li>
|
---|
49 | <li>sun (the standard converter of the JDK)</li>
|
---|
50 | <li>kaffe (the standard converter of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
|
---|
51 | </ul>
|
---|
52 |
|
---|
53 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
54 | <tr>
|
---|
55 | <td><b>Attribute</b></td>
|
---|
56 | <td><b>Description</b></td>
|
---|
57 | <td><b>Required</b></td>
|
---|
58 | </tr>
|
---|
59 | <tr>
|
---|
60 | <td>reverse</td>
|
---|
61 | <td>Reverse the sense of the conversion,
|
---|
62 | i.e. convert from ASCII to native <b>only supported by the
|
---|
63 | sun converter</b></td>
|
---|
64 | <td align="center">No</td>
|
---|
65 | </tr>
|
---|
66 | <tr>
|
---|
67 | <td>encoding</td>
|
---|
68 | <td>The native encoding the files are in
|
---|
69 | (default is the default encoding for the JVM)</td>
|
---|
70 | <td align="center">No</td>
|
---|
71 | </tr>
|
---|
72 | <tr>
|
---|
73 | <td>src</td>
|
---|
74 | <td>The directory to find files in (default is <em>basedir</em>)</td>
|
---|
75 | <td align="center">No</td>
|
---|
76 | </tr>
|
---|
77 | <tr>
|
---|
78 | <td>dest</td>
|
---|
79 | <td>The directory to output file to</td>
|
---|
80 | <td align="center">Yes</td>
|
---|
81 | </tr>
|
---|
82 | <tr>
|
---|
83 | <td>ext</td>
|
---|
84 | <td>File extension to use in renaming output files</td>
|
---|
85 | <td align="center">No</td>
|
---|
86 | </tr>
|
---|
87 | <tr>
|
---|
88 | <td>defaultexcludes</td>
|
---|
89 | <td>indicates whether default excludes should be used or not
|
---|
90 | ("yes"/"no").
|
---|
91 | Default excludes are used when omitted.
|
---|
92 | </td>
|
---|
93 | <td align="center">No</td>
|
---|
94 | </tr>
|
---|
95 | <tr>
|
---|
96 | <td>includes</td>
|
---|
97 | <td>comma- or space-separated list of patterns of files that must be
|
---|
98 | included. All files are included when omitted.</td>
|
---|
99 | <td align="center">No</td>
|
---|
100 | </tr>
|
---|
101 | <tr>
|
---|
102 | <td>includesfile</td>
|
---|
103 | <td>the name of a file. Each line of this file is
|
---|
104 | taken to be an include pattern</td>
|
---|
105 | <td align="center">No</td>
|
---|
106 | </tr>
|
---|
107 | <tr>
|
---|
108 | <td>excludes</td>
|
---|
109 | <td>comma- or space-separated list of patterns of files that must be excluded.
|
---|
110 | No files (except default excludes) are excluded when omitted.</td>
|
---|
111 | <td align="center">No</td>
|
---|
112 | </tr>
|
---|
113 | <tr>
|
---|
114 | <td>excludesfile</td>
|
---|
115 | <td>the name of a file. Each line of this file is
|
---|
116 | taken to be an exclude pattern</td>
|
---|
117 | <td align="center">No</td>
|
---|
118 | </tr>
|
---|
119 | <tr>
|
---|
120 | <td valign="top">implementation</td>
|
---|
121 | <td valign="top">The converter implementation to use.
|
---|
122 | If this attribute is not set, the default converter for the
|
---|
123 | current VM will be used. (See the above <a
|
---|
124 | href="#implementationvalues">list</a> of valid converters.)</td>
|
---|
125 | <td align="center" valign="top">No</td>
|
---|
126 | </tr>
|
---|
127 | </table>
|
---|
128 |
|
---|
129 | <h3>Parameters specified as nested elements</h3>
|
---|
130 |
|
---|
131 | <h4>arg</h4>
|
---|
132 |
|
---|
133 | <p>You can specify additional command line arguments for the converter
|
---|
134 | with nested <code><arg></code> elements. These elements are
|
---|
135 | specified like <a href="../using.html#arg">Command-line Arguments</a>
|
---|
136 | but have an additional attribute that can be used to enable arguments
|
---|
137 | only if a given converter implementation will be used.</p>
|
---|
138 |
|
---|
139 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
140 | <tr>
|
---|
141 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
142 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
143 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
144 | </tr>
|
---|
145 | <tr>
|
---|
146 | <td valign="top">value</td>
|
---|
147 | <td align="center" rowspan="4">See
|
---|
148 | <a href="../using.html#arg">Command-line Arguments</a>.</td>
|
---|
149 | <td align="center" rowspan="4">Exactly one of these.</td>
|
---|
150 | </tr>
|
---|
151 | <tr>
|
---|
152 | <td valign="top">line</td>
|
---|
153 | </tr>
|
---|
154 | <tr>
|
---|
155 | <td valign="top">file</td>
|
---|
156 | </tr>
|
---|
157 | <tr>
|
---|
158 | <td valign="top">path</td>
|
---|
159 | </tr>
|
---|
160 | <tr>
|
---|
161 | <td valign="top">implementation</td>
|
---|
162 | <td>Only pass the specified argument if the chosen converter
|
---|
163 | implementation matches the value of this attribute. Legal values
|
---|
164 | are the same as those in the above <a
|
---|
165 | href="#implementationvalues">list</a> of valid compilers.)</td>
|
---|
166 | <td align="center">No</td>
|
---|
167 | </tr>
|
---|
168 | </table>
|
---|
169 |
|
---|
170 | <h3>Examples</h3>
|
---|
171 |
|
---|
172 | <pre>
|
---|
173 | <native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
|
---|
174 | includes="**/*.eucjis" ext=".java"/>
|
---|
175 | </pre>
|
---|
176 |
|
---|
177 | <p>
|
---|
178 | Converts all files in the directory <em>srcdir</em>
|
---|
179 | ending in <code>.eucjis</code> from the EUCJIS encoding to ASCII
|
---|
180 | and renames them to end in <code>.java</code>.
|
---|
181 | </p>
|
---|
182 |
|
---|
183 | <pre>
|
---|
184 | <native2ascii encoding="EUCJIS" src="native/japanese" dest="src"
|
---|
185 | includes="**/*.java"/>
|
---|
186 | </pre>
|
---|
187 |
|
---|
188 | <p>
|
---|
189 | Converts all the files ending in <code>.java</code>
|
---|
190 | in the directory <em>native/japanese</em> to ASCII,
|
---|
191 | placing the results in the directory <em>src</em>.
|
---|
192 | The names of the files remain the same.
|
---|
193 | </p>
|
---|
194 | </body>
|
---|
195 | <hr>
|
---|
196 | <p align="center">Copyright © 2000-2002,2004-2005 The Apache Software Foundation. All rights
|
---|
197 | Reserved.</p>
|
---|
198 | </html>
|
---|