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

SunNative2Ascii

public final class SunNative2Ascii extends DefaultNative2Ascii
Adapter to sun.tools.native2ascii.Main.
since
Ant 1.6.3

Fields Summary
public static final String
IMPLEMENTATION_NAME
Identifies this adapter.
Constructors Summary
Methods Summary
protected booleanrun(org.apache.tools.ant.types.Commandline cmd, org.apache.tools.ant.ProjectComponent log)
{@inheritDoc}

        try {
            Class n2aMain = Class.forName("sun.tools.native2ascii.Main");
            Class[] param = new Class[] {String[].class};
            Method convert = n2aMain.getMethod("convert", param);
            if (convert == null) {
                throw new BuildException("Could not find convert() method in "
                                         + "sun.tools.native2ascii.Main");
            }
            Object o = n2aMain.newInstance();
            return ((Boolean) convert.invoke(o,
                                             new Object[] {cmd.getArguments()})
                    ).booleanValue();
        } catch (BuildException ex) {
            //rethrow
            throw ex;
        } catch (Exception ex) {
            //wrap
           throw new BuildException("Error starting Sun's native2ascii: ", ex);
        }
    
protected voidsetup(org.apache.tools.ant.types.Commandline cmd, org.apache.tools.ant.taskdefs.optional.Native2Ascii args)
{@inheritDoc}


      
         
          
        if (args.getReverse()) {
            cmd.createArgument().setValue("-reverse");
        }
        super.setup(cmd, args);