org.codehaus.mojo.javascript.compress
Interface JSCompressor

All Known Implementing Classes:
JSMinCompressor, ShrinksafeCompressor, YahooUICompressor

public interface JSCompressor

Abstraction of a JS compression tool.


Field Summary
static int JAVASCRIPT_1_1
          Javascript language versions
static int JAVASCRIPT_1_2
           
static int JAVASCRIPT_1_3
           
static int MAX
           
static int NONE
          Constants for optimization level
 
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
 

Field Detail

NONE

static final int NONE
Constants for optimization level

See Also:
Constant Field Values

MAX

static final int MAX
See Also:
Constant Field Values

JAVASCRIPT_1_1

static final int JAVASCRIPT_1_1
Javascript language versions

See Also:
Constant Field Values

JAVASCRIPT_1_2

static final int JAVASCRIPT_1_2
See Also:
Constant Field Values

JAVASCRIPT_1_3

static final int JAVASCRIPT_1_3
See Also:
Constant Field Values
Method Detail

setLogger

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

Parameters:
logger - a logger
Throws:
CompressionException

getLogger

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

Returns:
the current JSCompressorLogger used for logging
Throws:
CompressionException

compress

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).

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


Copyright © 2011 SOFTEC sa. All Rights Reserved.