rabbit.installer
Class Packer

java.lang.Object
  extended byrabbit.installer.Packer

public class Packer
extends java.lang.Object

This class packs a directory to a zipfile, for easy distribution of the RabbIT proxy.


Field Summary
static boolean verbose
          Should we run in verbose mode?
 
Constructor Summary
Packer()
          Create a new Packer that ask for directory and zip file.
Packer(java.lang.String dir, java.lang.String file)
          Create a new Packer with given directory and file.
 
Method Summary
 void addDir(java.lang.String path, java.io.File dir, java.util.zip.ZipOutputStream zos)
          Add a directory to a zipfile.
 void addFile(java.lang.String path, java.io.File f, java.util.zip.ZipOutputStream zos)
          Add a file to a zipfile.
 void createZip(java.io.File dir, java.io.File zipfile)
          Create the zipfile and add the directory to it.
static void main(java.lang.String[] args)
          Start a new Packer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verbose

public static boolean verbose
Should we run in verbose mode?

Constructor Detail

Packer

public Packer()
Create a new Packer that ask for directory and zip file.


Packer

public Packer(java.lang.String dir,
              java.lang.String file)
Create a new Packer with given directory and file.

Parameters:
dir - the directory to pack.
file - the name of the zip file.
Method Detail

main

public static void main(java.lang.String[] args)
Start a new Packer.


createZip

public void createZip(java.io.File dir,
                      java.io.File zipfile)
               throws java.io.IOException
Create the zipfile and add the directory to it.

Parameters:
dir - the file of the zipfile.
zipfile - the name of the zip file to create.
Throws:
java.io.IOException - if creation of file fails.

addDir

public void addDir(java.lang.String path,
                   java.io.File dir,
                   java.util.zip.ZipOutputStream zos)
            throws java.io.IOException
Add a directory to a zipfile.

Parameters:
path - the path to prepend to the files in this directory.
dir - the directory to add.
zos - the zipstream we are writing to.
Throws:
java.io.IOException - if writing to the zipfile fails.

addFile

public void addFile(java.lang.String path,
                    java.io.File f,
                    java.util.zip.ZipOutputStream zos)
             throws java.io.IOException
Add a file to a zipfile.

Parameters:
path - the path to prepend to the filename.
f - the File to add to the zip.
zos - the zipstream we are writing to.
Throws:
java.io.IOException - if writing to the zipfile fails.