org.codehaus.mojo.javascript.compress
Class JSMinCompressor

java.lang.Object
  extended by org.codehaus.mojo.javascript.compress.JSMinCompressor
All Implemented Interfaces:
JSCompressor

public class JSMinCompressor
extends java.lang.Object
implements JSCompressor

Use the Java version of the JSMin algorithm to compress a set of JS files. For simplicity, the JSMin code (one class) is included in the plugin.

Author:
nicolas De Loof
See Also:
http://www.crockford.com/javascript/jsmin.html

Field Summary
 
Fields inherited from interface org.codehaus.mojo.javascript.compress.JSCompressor
JAVASCRIPT_1_1, JAVASCRIPT_1_2, JAVASCRIPT_1_3, MAX, NONE
 
Constructor Summary
JSMinCompressor()
           
 
Method Summary
 void compress(java.io.File input, java.io.File output, int level, int language)
          Compress the input script file into the output file (may be same).
 JSCompressorLogger getLogger()
          Return current JSCompressorLogger used for logging
 void setLogger(JSCompressorLogger logger)
          Set a the JSCompressorLogger implementation that will receive logs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSMinCompressor

public JSMinCompressor()
Method Detail

compress

public void compress(java.io.File input,
                     java.io.File output,
                     int level,
                     int language)
              throws CompressionException
Compress the input script file into the output file (may be same).

Specified by:
compress in interface JSCompressor
Parameters:
input - source to get compressed
output - compressed script
level - optimization level from 0 to 9. May have various signification dependending on the compressor, from beeing ignored to some fine tweaking the output.
language - version of javascript to be used ("130" for JS 1.3), as defined by Mozilla Rhino engine
Throws:
CompressionException - any error during compression
See Also:
JSCompressor.compress(java.io.File, java.io.File, int, int)

setLogger

public void setLogger(JSCompressorLogger logger)
               throws CompressionException
Set a the JSCompressorLogger implementation that will receive logs

Specified by:
setLogger in interface JSCompressor
Parameters:
logger - a logger
Throws:
CompressionException

getLogger

public JSCompressorLogger getLogger()
                             throws CompressionException
Return current JSCompressorLogger used for logging

Specified by:
getLogger in interface JSCompressor
Returns:
the current JSCompressorLogger used for logging
Throws:
CompressionException


Copyright © 2011 SOFTEC sa. All Rights Reserved.