org.hecl.jarhack
Class JarHack

java.lang.Object
  extended by org.hecl.jarhack.JarHack

public class JarHack
extends java.lang.Object

JarHack -- this class provides several static methods that can be used to create .jar and .jad files from a template Hecl.jar and some user supplied information, such as the output file, and the name of the new application.

Version:
1.0
Author:
David N. Welton

Constructor Summary
JarHack()
           
 
Method Summary
static void createJadForJar(java.lang.String jarfile, java.lang.String appname)
          The createJadForJar method calls createJadForJar with a url created from the application's name.
static void createJadForJar(java.lang.String jarfile, java.lang.String appname, java.lang.String url)
          The createJadForJar method creates a new .jad file that matches the .jar file passed to it.
static void main(java.lang.String[] args)
          main implements a command line version of JarHack that takes five arguments: 1.
static void substHecl(java.io.InputStream infile, java.lang.String outfile, java.lang.String newname, java.lang.String iconname, java.lang.String scriptfile)
          The substHecl method takes the filenames of two .jar's - one as input, the second as output, in addition to the name of the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarHack

public JarHack()
Method Detail

substHecl

public static void substHecl(java.io.InputStream infile,
                             java.lang.String outfile,
                             java.lang.String newname,
                             java.lang.String iconname,
                             java.lang.String scriptfile)
                      throws java.io.IOException
The substHecl method takes the filenames of two .jar's - one as input, the second as output, in addition to the name of the application. Where it counts, the old name (Hecl, usually) is overridden with the new name, and the new .jar file is written to the specified outfile. Via the iconname argument it is also possible to specify a new icon file to use.

Parameters:
infile - a FileInputStream value
outfile - a String value
newname - a String value
iconname - a String value
Throws:
java.io.IOException - if an error occurs

createJadForJar

public static void createJadForJar(java.lang.String jarfile,
                                   java.lang.String appname)
                            throws java.io.IOException
The createJadForJar method calls createJadForJar with a url created from the application's name.

Parameters:
jarfile - a String value
appname - a String value
Throws:
java.io.IOException - if an error occurs

createJadForJar

public static void createJadForJar(java.lang.String jarfile,
                                   java.lang.String appname,
                                   java.lang.String url)
                            throws java.io.IOException
The createJadForJar method creates a new .jad file that matches the .jar file passed to it. appname is the name of the new application.

Parameters:
jarfile - a String value
appname - a String value
url - a String value
Throws:
java.io.IOException - if an error occurs

main

public static void main(java.lang.String[] args)
                 throws org.apache.commons.cli.ParseException
main implements a command line version of JarHack that takes five arguments: 1. The original 'template' .jar file to use. 2. The destination directory where you want to create your new application. 3. The name of your new application as it will appear in the MIDlet. 4. The name of the Hecl script you want to use instead of the script.hcl that is included in the 'source' .jar file. 5. The URL where your jar file will reside.

Parameters:
args - a String[] value
Throws:
org.apache.commons.cli.ParseException