FileDocCategorySizeDatePackage
DefaultNative2Ascii.javaAPI DocApache Ant 1.703827Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.native2ascii

DefaultNative2Ascii

public abstract class DefaultNative2Ascii extends Object implements Native2AsciiAdapter
encapsulates the handling common to diffent Native2Asciiadapter implementations.
since
Ant 1.6.3

Fields Summary
Constructors Summary
public DefaultNative2Ascii()
No-arg constructor.

    
Methods Summary
protected voidaddFiles(org.apache.tools.ant.types.Commandline cmd, org.apache.tools.ant.ProjectComponent log, java.io.File src, java.io.File dest)
Adds source and dest files to the command line.

This implementation adds them without any leading qualifiers, source first.

param
cmd Command line to add to
param
log provides access to Ant's logging system.
param
src the source file
param
dest the destination file
throws
BuildException if there was a problem.

        cmd.createArgument().setFile(src);
        cmd.createArgument().setFile(dest);
    
public final booleanconvert(org.apache.tools.ant.taskdefs.optional.Native2Ascii args, java.io.File srcFile, java.io.File destFile)
Splits the task into setting up the command line switches

param
args the native 2 ascii arguments.
param
srcFile the source file.
param
destFile the destination file.
return
run if the conversion was successful.
throws
BuildException if there is a problem. (delegated to {@link #setup setup}), adding the file names (delegated to {@link #addFiles addFiles}) and running the tool (delegated to {@link #run run}).

        Commandline cmd = new Commandline();
        setup(cmd, args);
        addFiles(cmd, args, srcFile, destFile);
        return run(cmd, args);
    
protected abstract booleanrun(org.apache.tools.ant.types.Commandline cmd, org.apache.tools.ant.ProjectComponent log)
Executes the command.

param
cmd Command line to execute
param
log provides access to Ant's logging system.
return
whether execution was successful
throws
BuildException if there was a problem.

protected voidsetup(org.apache.tools.ant.types.Commandline cmd, org.apache.tools.ant.taskdefs.optional.Native2Ascii args)
Sets up the initial command line.

only the -encoding argument and nested arg elements get handled here.

param
cmd Command line to add to
param
args provides the user-setting and access to Ant's logging system.
throws
BuildException if there was a problem.

        if (args.getEncoding() != null) {
            cmd.createArgument().setValue("-encoding");
            cmd.createArgument().setValue(args.getEncoding());
        }
        cmd.addArguments(args.getCurrentArgs());