public final class JSMin extends Object
This class is a slightly modified version of the work done by John Reilly who initially adapted Douglas Crockford's C version of his JavaScript minimiser.
Modifier and Type | Class and Description |
---|---|
static class |
JSMin.UnterminatedCommentException
A comment that does not terminate properly.
|
static class |
JSMin.UnterminatedRegExpLiteralException
A regular expression that does not terminate properly.
|
static class |
JSMin.UnterminatedStringLiteralException
A string that does not terminate properly.
|
Constructor and Description |
---|
JSMin(InputStream in,
OutputStream out)
Creates a new JavaScript minimiser for the specified I/O.
|
Modifier and Type | Method and Description |
---|---|
void |
jsmin()
Main JSMin method.
|
static void |
main(String[] arg)
To invoke the minimizer on the command line.
|
public JSMin(InputStream in, OutputStream out)
in
- The JavaScript to minimise.out
- The minimised script.public void jsmin() throws IOException, ParsingException
Copy the input to the output, deleting the characters which are insignificant to JavaScript:
IOException
- If an error occurs while reading the input or writing on the output.ParsingException
- If an error occurs while parsing the JavaScript (minimizing is not possible then).public static void main(String[] arg)
arg
- name of file to minimizeCopyright © 2016 Allette Systems. All rights reserved.