Utility class to compile a (set of) Resorcer subclass(es). This
is a very elaborated example of a user interface to ClassCompiler,
the class that actually compiles Cramfull classes.
ResourceCompiler compiles a set of resource files into one or more
Cramfull subclasses. An example of also compiling serialized objects
into Cramfull subclasses is given in SerializingResourceCompiler
We supply this class as a free service to all users of the
Cramfull Compiled Resources library.
You are allowed to modify this source code, provided you move the class out of
the be.arci package hierarchy.
Any number of arguments of each type can be given. Commandline arguments are
interpreted left to right, command file arguments top to bottom.
Command file with 1 argument per
line; comment lines start with '#'
-v or -q
Verbose mode or Quiet mode
-s or -i
Subsequent resource patterns are
case Sensitive (default) or case Insensitive
Temporary base directory to read subsequent
resources from and write subsequent output to.
Create Cramfull subclass named Out
(a qualified class name)
Replace or create Cramfull subclass named
Out (a qualified class name)
Subsequent resources will be encoded in the class Out. The
default Out name is "MyCramfull", in replace mode.
The class-file for any previous Out argument is compiled
when a new Out argument is encountered. A package directory
tree for Out is created as needed.
Put resources into a nested class Out$Data of
Out. The nested class can be garbage collected immediately
after class initialization. This option is uneffective in the evaluation
version of the Cramfull Compiled Resources library.
Use the qualified classname Enc (an Encoder subclass)
to encode subsequent resources. Default is "be.arci.cramfull.ASCIIEncoder"
Resource filename or pattern ('*' and '?' are the wildcards).
Resources will be encoded into the current Out class with a
newInstance() of the current Enc class. The resource's
name in Out is the suffix of it's canonical file name that corresponds
to the Resrce argument, but with '/' as the separator char. Simply
specify a directory to encode all files in it. Use the escapes '@@' and
'--' for resource names starting with '@' or '-'.
java be.arci.pub.ResourceCompiler -n -v -bREDIST -cIconResources -bc:\artwork images/*.gif @localized.txt
#defaults for all locales
#french France locale
This command and command file will compile the following Cramfull
subclasses into the directory REDIST:
creates files REDIST/IconResources.class and
REDIST/IconResources$Data.class, with all .gif files from the
c:\artwork\images directory, having resource names like
replaces files REDIST/com/mydomain/profiles/Setup.class
and REDIST/com/mydomain/profiles/Setup$Data.class, with all .gif,
.jpg and .properties files of the working directory, with no path
prefix in the resource name
replaces files REDIST/com/mydomain/profiles/Setup_fr_FR.class
and REDIST/com/mydomain/profiles/Setup_fr_FR$Data.class, with all files of the
France directory, with no path prefix in the resource name
replaces files REDIST/com/mydomain/profiles/Setup_en.class
and REDIST/com/mydomain/profiles/Setup_en$Data.class, with all files of the
English directory, with no path prefix in the resource name
In the evaluation version the -n option has no effect, and the encoded
resource data is not placed in nested Out$Data.class files, but directly
in the Cramfull subclass Out.class.
In the evaluation version a maximum of about 100 resources can be encoded
in 1 class file, each resource being limited to some 300kB (depending on
the encoding and the type of data).