java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4091
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Native2Ascii task E-mail
User Rating: / 3
PoorBest 

Native2Ascii

Description:

Converts files from native encodings to ASCII with escaped Unicode. A common usage is to convert source files maintained in a native operating system encoding, to ASCII prior to compilation.

Files in the directory src are converted from a native encoding to ASCII. By default, all files in the directory are converted. However, conversion may be limited to selected files using includes and excludes attributes. For more information on file matching patterns, see the section on directory based tasks. If no encoding is specified, the default encoding for the JVM is used. If ext is specified, then output files are renamed to use it as a new extension. More sophisticated file name translations can be achieved using a nested <mapper> element. By default an identity mapper will be used. If dest and src point to the same directory, the ext attribute or a nested <mapper> is required.

This task forms an implicit File Set, and supports all attributes of <fileset> (dir becomes src) as well as nested <include>, <exclude>, and <patternset> elements.

It is possible to use different converters. This can be selected with the implementation attribute. Here are the choices:

  • default - the default converter (kaffe or sun) for the platform.
  • sun (the standard converter of the JDK)
  • kaffe (the standard converter of Kaffe)
Attribute Description Required
reverse Reverse the sense of the conversion, i.e. convert from ASCII to native only supported by the sun converter No
encoding The native encoding the files are in (default is the default encoding for the JVM) No
src The directory to find files in (default is basedir) No
dest The directory to output file to Yes
ext File extension to use in renaming output files No
defaultexcludes indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. No
includes comma- or space-separated list of patterns of files that must be included. All files are included when omitted. No
includesfile the name of a file. Each line of this file is taken to be an include pattern No
excludes comma- or space-separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. No
excludesfile the name of a file. Each line of this file is taken to be an exclude pattern No
implementation The converter implementation to use. If this attribute is not set, the default converter for the current VM will be used. (See the above list of valid converters.) No

Parameters specified as nested elements

arg

You can specify additional command line arguments for the converter with nested <arg> elements. These elements are specified like Command-line Arguments but have an additional attribute that can be used to enable arguments only if a given converter implementation will be used.

Attribute Description Required
value See Command-line Arguments. Exactly one of these.
line
file
path
implementation Only pass the specified argument if the chosen converter implementation matches the value of this attribute. Legal values are the same as those in the above list of valid compilers.) No

Examples

<native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"

   includes="**/*.eucjis" ext=".java"/>
    

Converts all files in the directory srcdir ending in .eucjis from the EUCJIS encoding to ASCII and renames them to end in .java.

<native2ascii encoding="EUCJIS" src="native/japanese" dest="src"

   includes="**/*.java"/>

Converts all the files ending in .java in the directory native/japanese to ASCII, placing the results in the directory src. The names of the files remain the same.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.