Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs.optional

public Class Native2Ascii

extends MatchingTask
Class Inheritance
Imports
java.io.File, org.apache.tools.ant.BuildException, .DirectoryScanner, .Project, org.apache.tools.ant.taskdefs.MatchingTask, org.apache.tools.ant.taskdefs.optional.native2ascii.Native2AsciiAdapter, .Native2AsciiAdapterFactory, org.apache.tools.ant.types.Mapper, .Path, org.apache.tools.ant.util.FileNameMapper, .IdentityMapper, .SourceFileScanner, org.apache.tools.ant.util.facade.FacadeTaskHelper, .ImplementationSpecificArgument

Converts files from native encodings to ASCII.
Since
Ant 1.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private File
private String
private String
private FacadeTaskHelper
private Mapper
private Native2AsciiAdapter
private boolean
private File
Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset

Constructor Summary

AccessConstructor and Description
public
Native2Ascii()

No args constructor

Method Summary

Modifier and TypeMethod and Description
public void
add(FileNameMapper
the mapper to add
fileNameMapper
)

A nested filenamemapper

public void
add(Native2AsciiAdapter
Native2AsciiAdapter
adapter
)

Set the adapter explicitly.

private void
convert(String
name of the input file.
srcName
,
String
name of the input file.
destName
)

Convert a single file.

public ImplementationSpecificArgument

Returns:

a ImplementationSpecificArgument to be configured
createArg
()

Adds an implementation specific command-line argument.

public Path

Returns:

Path
createImplementationClasspath
()

The classpath to use when loading the native2ascii implementation if it is not a built-in one.

public Mapper

Returns:

the mapper to use for file name translations.
createMapper
()

Defines the FileNameMapper to use (nested mapper element).

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task
public String[]

Returns:

the arguments.
getCurrentArgs
()

Returns the (implementation specific) settings given as nested arg elements.

public String

Returns:

the encoding attribute.
getEncoding
()

The value of the encoding attribute.

public boolean

Returns:

the reverse attribute.
getReverse
()

The value of the reverse attribute.

public void
setDest(File
directory to place output file into.
destDir
)

Set the destination directory to place converted files into.

public void
setEncoding(String
String containing the name of the Native encoding to convert from or to.
encoding
)

Set the encoding to translate to/from.

public void
setExt(String
File extension to use for converted files.
ext
)

Set the extension which converted files should have.

public void
setImplementation(String
the name of the implementation
impl
)

Choose the implementation for this particular task.

public void
setReverse(boolean
True if the conversion is to be reversed, otherwise false;
reverse
)

Flag the conversion to run in the reverse sense, that is Ascii to Native encoding.

public void
setSrc(File
directory to find input file in.
srcDir
)

Set the source directory in which to find files to convert.

Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
addaddAndaddContainsaddContainsRegexpaddCustomaddDateaddDependaddDepthaddDifferentaddFilenameaddMajorityaddModifiedaddNoneaddNotaddOraddPresentaddSelectoraddSizeaddTypeappendSelectorcreateExcludecreateExcludesFilecreateIncludecreateIncludesFilecreatePatternSetgetDirectoryScannergetImplicitFileSetgetSelectorshasSelectorsselectorCountselectorElementssetCaseSensitivesetDefaultexcludessetExcludessetExcludesfilesetFollowSymlinkssetIncludessetIncludesfilesetProjectXsetIgnoreXsetItems

Field Detail

destDirback to summary
private File destDir
encodingback to summary
private String encoding
extensionback to summary
private String extension
facadeback to summary
private FacadeTaskHelper facade
mapperback to summary
private Mapper mapper
nestedAdapterback to summary
private Native2AsciiAdapter nestedAdapter
reverseback to summary
private boolean reverse
srcDirback to summary
private File srcDir

Constructor Detail

Native2Asciiback to summary
public Native2Ascii()

No args constructor

Method Detail

addback to summary
public void add(FileNameMapper fileNameMapper)

A nested filenamemapper

Parameters
fileNameMapper:FileNameMapper

the mapper to add

Since
Ant 1.6.3
addback to summary
public void add(Native2AsciiAdapter adapter)

Set the adapter explicitly.

Parameters
adapter:Native2AsciiAdapter

Native2AsciiAdapter

Since
Ant 1.8.0
convertback to summary
private void convert(String srcName, String destName) throws BuildException

Convert a single file.

Parameters
srcName:String

name of the input file.

destName:String

name of the input file.

createArgback to summary
public ImplementationSpecificArgument createArg()

Adds an implementation specific command-line argument.

Returns:ImplementationSpecificArgument

a ImplementationSpecificArgument to be configured

Since
Ant 1.6.3
createImplementationClasspathback to summary
public Path createImplementationClasspath()

The classpath to use when loading the native2ascii implementation if it is not a built-in one.

Returns:Path

Path

Since
Ant 1.8.0
createMapperback to summary
public Mapper createMapper() throws BuildException

Defines the FileNameMapper to use (nested mapper element).

Returns:Mapper

the mapper to use for file name translations.

Exceptions
BuildException:
if more than one mapper is defined.
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task

Annotations
@Override
Exceptions
BuildException:
is there is a problem in the task execution.
getCurrentArgsback to summary
public String[] getCurrentArgs()

Returns the (implementation specific) settings given as nested arg elements.

Returns:String[]

the arguments.

Since
Ant 1.6.3
getEncodingback to summary
public String getEncoding()

The value of the encoding attribute.

Returns:String

the encoding attribute.

Since
Ant 1.6.3
getReverseback to summary
public boolean getReverse()

The value of the reverse attribute.

Returns:boolean

the reverse attribute.

Since
Ant 1.6.3
setDestback to summary
public void setDest(File destDir)

Set the destination directory to place converted files into.

Parameters
destDir:File

directory to place output file into.

setEncodingback to summary
public void setEncoding(String encoding)

Set the encoding to translate to/from. If unset, the default encoding for the JVM is used.

Parameters
encoding:String

String containing the name of the Native encoding to convert from or to.

setExtback to summary
public void setExt(String ext)

Set the extension which converted files should have. If unset, files will not be renamed.

Parameters
ext:String

File extension to use for converted files.

setImplementationback to summary
public void setImplementation(String impl)

Choose the implementation for this particular task.

Parameters
impl:String

the name of the implementation

Since
Ant 1.6.3
setReverseback to summary
public void setReverse(boolean reverse)

Flag the conversion to run in the reverse sense, that is Ascii to Native encoding.

Parameters
reverse:boolean

True if the conversion is to be reversed, otherwise false;

setSrcback to summary
public void setSrc(File srcDir)

Set the source directory in which to find files to convert.

Parameters
srcDir:File

directory to find input file in.

org.apache.tools.ant.taskdefs.optional back to summary

private Class Native2Ascii.ExtMapper

extends Object
implements FileNameMapper
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.taskdefs.optional.Native2Ascii.ExtMapper
All Implemented Interfaces
org.apache.tools.ant.util.FileNameMapper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String[]
mapFileName(String
the name of the source file relative to some given basedirectory. Might be null for resources that don't provide a name.
fileName
)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Returns an array containing the target filename(s) for the given source file.
public void
setFrom(String
a string.
s
)

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Sets the from part of the transformation rule.
public void
setTo(String
a string.
s
)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Sets the to part of the transformation rule.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ExtMapperback to summary
private ExtMapper()

Method Detail

mapFileNameback to summary
public String[] mapFileName(String fileName)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Doc from org.apache.tools.ant.util.FileNameMapper.mapFileName.

Returns an array containing the target filename(s) for the given source file.

if the given rule doesn't apply to the source file, implementation must return null. SourceFileScanner will then omit the source file in question.

Parameters
fileName:String

the name of the source file relative to some given basedirectory. Might be null for resources that don't provide a name.

Returns:String[]

an array of strings if the rule applies to the source file, or null if it does not.

Annotations
@Override
setFromback to summary
public void setFrom(String s)

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Doc from org.apache.tools.ant.util.FileNameMapper.setFrom.

Sets the from part of the transformation rule.

Parameters
s:String

a string.

Annotations
@Override
setToback to summary
public void setTo(String s)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Doc from org.apache.tools.ant.util.FileNameMapper.setTo.

Sets the to part of the transformation rule.

Parameters
s:String

a string.

Annotations
@Override