Avoid writing unmodified classes in CodeWriter's writeJar()

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid anonymous class in LegacyHooks

The LegacyHooks class wants to be shared between class loaders. As such,
it even the LegacyClassLoader needs to be able to find the classes defined
in that class. We cannot do that easily with an anonmous, class, so let's
make the Comparator for fat .jar file names a nested class.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add some Javadoc to CodeHacker

It may not be part of the public API, but it is nice to have some
documentation nevertheless.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: add a writeJar() method including unpatched classes

In scenarios when javassist is not an option, we will want to write a
replacement .jar containing the patched classes. This method will help.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyInjector: add a static method to write out a patched .jar file

The code to write out a misc/headless.jar was not quite maintained when
moving the code from ij-legacy into ij1-patcher.

This change reinstates a public API to allow that, and as a bonus, it
also allows to include even the ImageJ 1.x classes that were not patched
as well as the resources needed to run it. In other words, running

	File jarFile = new File("ij.jar");
	boolean headless = false;
	boolean fullJar = true;
	LegacyInjector.writeJar(jarFile, headless, fullJar);

will write out an ij.jar that can be used *without* ij1-patcher.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyInjector.writeJar(): handle ImageJ 1.x in a .jar file gracefully

So far, this topic branch was only tested in Eclipse, with ImageJ 1.x in
the workspace, i.e. available as an unpacked directory. Things change a
bit when running it outside, on .jar files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid patching patched ij.jar

When we're running with an ij.jar that has been written out using
LegacyInjector.writeJar(), we should not try to patch it again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge pull request #6 from imagej/write-jar

Add a public API to write a .jar file with the patched classes