net.sf.javascriptzip
Class JavaScriptZip

java.lang.Object
  extended by net.sf.javascriptzip.JavaScriptZip

public class JavaScriptZip
extends java.lang.Object

This class processes the JavaScript compression.
The compress methods is overloaded on two forms: One takes the String containing the script source, and returns the compressed contents; and other that receives an input and output file.
The main method may be called externally also.

Author:
Luis Fernando Planella Gonzalez - lfpg.dev@gmail.com

Constructor Summary
JavaScriptZip()
           
 
Method Summary
static JavaScriptZip buildFromArguments(java.lang.String[] args)
          Returns an instance built from the command-line arguments.
static JavaScriptZip buildFromProperties(java.util.Properties props)
          Returns an instance built from a Properties object.
 void compress()
          Compress the script, getting the input and output from this instance's input and output properties
 void compress(java.io.File in, java.io.File out)
          Compress the input file, storing it on the output file
 java.lang.String compress(java.lang.String script)
          Compress the script, represented by the input string
 java.lang.String getFooter()
           
 java.lang.String getHeader()
           
 java.io.File getInput()
           
 java.io.File getOutput()
           
 boolean isDisableOptimizations()
           
static void main(java.lang.String[] args)
          Runs JavaScriptZip from the command line.
 void setDisableOptimizations(boolean disableOptimizations)
           
 void setFooter(java.lang.String footer)
           
 void setHeader(java.lang.String header)
           
 void setInput(java.io.File input)
           
 void setOutput(java.io.File output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptZip

public JavaScriptZip()
Method Detail

buildFromArguments

public static JavaScriptZip buildFromArguments(java.lang.String[] args)
Returns an instance built from the command-line arguments. Th

Parameters:
args - The arguments.
Returns:
The JavaScriptZip instance

buildFromProperties

public static JavaScriptZip buildFromProperties(java.util.Properties props)
Returns an instance built from a Properties object.

Parameters:
props - The properties. The following properties are read: input, output, header, footer and disableOptimizations
Returns:
The JavaScriptZip instance

main

public static void main(java.lang.String[] args)
Runs JavaScriptZip from the command line.
The arguments are passed by their order, and are:

Parameters:
args - The command line arguments

compress

public void compress()
              throws java.io.IOException
Compress the script, getting the input and output from this instance's input and output properties

Throws:
java.io.IOException - Error reading / writing the files

compress

public void compress(java.io.File in,
                     java.io.File out)
              throws java.io.IOException
Compress the input file, storing it on the output file

Parameters:
in - The input file
out - The output file
Throws:
java.io.IOException - Error reading / writing the files

compress

public java.lang.String compress(java.lang.String script)
Compress the script, represented by the input string

Parameters:
script - The original script contents
Returns:
The compressed script

getFooter

public java.lang.String getFooter()
Returns:
Returns the footer.

getHeader

public java.lang.String getHeader()
Returns:
Returns the header.

getInput

public java.io.File getInput()

getOutput

public java.io.File getOutput()

isDisableOptimizations

public boolean isDisableOptimizations()

setDisableOptimizations

public void setDisableOptimizations(boolean disableOptimizations)

setFooter

public void setFooter(java.lang.String footer)
Parameters:
footer - The footer to set.

setHeader

public void setHeader(java.lang.String header)
Parameters:
header - The header to set.

setInput

public void setInput(java.io.File input)

setOutput

public void setOutput(java.io.File output)