org.tizen.web.compressor.minifier.core_2.0.0.201310251448

16:50:36.851 INFO  jd.cli.Main - Decompiling org.tizen.web.compressor.minifier.core_2.0.0.201310251448.jar
package org.tizen.web.compressor.minifier.core;

import java.util.HashSet;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.FileUtil;

public abstract class AbstractMinifier
  implements IMinifier
{
  protected final Logger logger = LoggerFactory.getLogger(getClass());
  protected final Set<String> extensions = new HashSet();
  
  public AbstractMinifier(String[] extensions)
  {
    String[] arrayOfString;
    int j = (arrayOfString = extensions).length;
    for (int i = 0; i < j; i++)
    {
      String ext = arrayOfString[i];
      this.extensions.add(ext.toLowerCase());
    }
  }
  
  protected Set<String> getExtensions()
  {
    return extensions;
  }
  
  public boolean canHandle(String name)
  {
    logger.trace("Name: {}", name);
    String fileExt = FileUtil.getFileExtension(name);
    logger.trace("Extension: {}", fileExt);
    if (fileExt == null)
    {
      logger.debug("No extension");
      return false;
    }
    fileExt = fileExt.toLowerCase();
    
    Set<String> exts = getExtensions();
    logger.debug("Extension candidate: {}", exts);
    return exts.contains(fileExt);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.AbstractMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

public class CSSMinifier
  extends AbstractMinifier
{
  protected static final String[] CSS_FILE_EXTENSIONS = { "css" };
  
  public CSSMinifier()
  {
    super(CSS_FILE_EXTENSIONS);
  }
  
  /* Error */
  public void compress(java.io.InputStream source, java.io.OutputStream target)
    throws java.io.IOException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aconst_null
    //   3: astore 4
    //   5: new 29	java/io/InputStreamReader
    //   8: dup
    //   9: aload_1
    //   10: invokespecial 31	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   13: astore_3
    //   14: new 34	java/io/OutputStreamWriter
    //   17: dup
    //   18: aload_2
    //   19: invokespecial 36	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;)V
    //   22: astore 4
    //   24: new 39	com/yahoo/platform/yui/compressor/CssCompressor
    //   27: dup
    //   28: aload_3
    //   29: invokespecial 41	com/yahoo/platform/yui/compressor/CssCompressor:<init>	(Ljava/io/Reader;)V
    //   32: astore 5
    //   34: aload 5
    //   36: aload 4
    //   38: iconst_m1
    //   39: invokevirtual 44	com/yahoo/platform/yui/compressor/CssCompressor:compress	(Ljava/io/Writer;I)V
    //   42: goto +29 -> 71
    //   45: astore 5
    //   47: aload 5
    //   49: athrow
    //   50: astore 6
    //   52: iconst_2
    //   53: anewarray 47	java/lang/Object
    //   56: dup
    //   57: iconst_0
    //   58: aload_3
    //   59: aastore
    //   60: dup
    //   61: iconst_1
    //   62: aload 4
    //   64: aastore
    //   65: invokestatic 49	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   68: aload 6
    //   70: athrow
    //   71: iconst_2
    //   72: anewarray 47	java/lang/Object
    //   75: dup
    //   76: iconst_0
    //   77: aload_3
    //   78: aastore
    //   79: dup
    //   80: iconst_1
    //   81: aload 4
    //   83: aastore
    //   84: invokestatic 49	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   87: return
    // Line number table:
    //   Java source line #60	-> byte code offset #0
    //   Java source line #61	-> byte code offset #2
    //   Java source line #64	-> byte code offset #5
    //   Java source line #65	-> byte code offset #14
    //   Java source line #66	-> byte code offset #24
    //   Java source line #67	-> byte code offset #34
    //   Java source line #68	-> byte code offset #45
    //   Java source line #69	-> byte code offset #47
    //   Java source line #70	-> byte code offset #50
    //   Java source line #71	-> byte code offset #58
    //   Java source line #72	-> byte code offset #68
    //   Java source line #70	-> byte code offset #71
    //   Java source line #71	-> byte code offset #77
    //   Java source line #73	-> byte code offset #87
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	88	0	this	CSSMinifier
    //   0	88	1	source	java.io.InputStream
    //   0	88	2	target	java.io.OutputStream
    //   1	77	3	reader	java.io.InputStreamReader
    //   3	79	4	writer	java.io.OutputStreamWriter
    //   32	3	5	compressor	com.yahoo.platform.yui.compressor.CssCompressor
    //   45	3	5	e	java.io.IOException
    //   50	19	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   5	42	45	java/io/IOException
    //   5	50	50	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.CSSMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import com.googlecode.htmlcompressor.compressor.HtmlCompressor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.tizen.common.util.IOUtil;

public class HTMLMinifier
  extends AbstractMinifier
  implements IMinifier
{
  protected static final String[] HTML_FILE_EXTENSIONS = { "htm", "html" };
  
  public HTMLMinifier()
  {
    super(HTML_FILE_EXTENSIONS);
  }
  
  public void compress(InputStream source, OutputStream target)
    throws IOException
  {
    HtmlCompressor compressor = new HtmlCompressor();
    compressor.setCompressJavaScript(true);
    compressor.setCompressCss(true);
    
    String compressedHtml = compressor.compress(IOUtil.getString(source, true));
    target.write(compressedHtml.getBytes());
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.HTMLMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public abstract interface IMinifier
{
  public abstract boolean canHandle(String paramString);
  
  public abstract void compress(InputStream paramInputStream, OutputStream paramOutputStream)
    throws IOException;
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.IMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import org.mozilla.javascript.ErrorReporter;
import org.mozilla.javascript.EvaluatorException;
import org.slf4j.Logger;

class JavaScriptMinifier$1
  implements ErrorReporter
{
  JavaScriptMinifier$1(JavaScriptMinifier paramJavaScriptMinifier) {}
  
  public void warning(String message, String sourceName, int line, String lineSource, int lineOffset)
  {
    if (line < 0)
    {
      this$0.logger.warn(message);
    }
    else
    {
      String logMessage = line + " : " + lineOffset + " : " + message;
      this$0.logger.warn(logMessage);
    }
    throw new EvaluatorException(message, sourceName, line, lineSource, lineOffset);
  }
  
  public void error(String message, String sourceName, int line, String lineSource, int lineOffset)
  {
    if (line < 0)
    {
      this$0.logger.error(message);
    }
    else
    {
      String logMessage = line + " : " + lineOffset + " : " + message;
      this$0.logger.error(logMessage);
    }
    throw new EvaluatorException(message, sourceName, line, lineSource, lineOffset);
  }
  
  /* Error */
  public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 6
    //   3: aload_0
    //   4: aload_1
    //   5: aload_2
    //   6: iload_3
    //   7: aload 4
    //   9: iload 5
    //   11: invokevirtual 76	org/tizen/web/compressor/minifier/core/JavaScriptMinifier$1:error	(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V
    //   14: goto +59 -> 73
    //   17: astore 7
    //   19: aload 7
    //   21: astore 6
    //   23: aload 6
    //   25: ifnonnull +69 -> 94
    //   28: new 58	org/mozilla/javascript/EvaluatorException
    //   31: dup
    //   32: aload_1
    //   33: aload_2
    //   34: iload_3
    //   35: aload 4
    //   37: iload 5
    //   39: invokespecial 60	org/mozilla/javascript/EvaluatorException:<init>	(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V
    //   42: astore 6
    //   44: goto +50 -> 94
    //   47: astore 8
    //   49: aload 6
    //   51: ifnonnull +19 -> 70
    //   54: new 58	org/mozilla/javascript/EvaluatorException
    //   57: dup
    //   58: aload_1
    //   59: aload_2
    //   60: iload_3
    //   61: aload 4
    //   63: iload 5
    //   65: invokespecial 60	org/mozilla/javascript/EvaluatorException:<init>	(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V
    //   68: astore 6
    //   70: aload 8
    //   72: athrow
    //   73: aload 6
    //   75: ifnonnull +19 -> 94
    //   78: new 58	org/mozilla/javascript/EvaluatorException
    //   81: dup
    //   82: aload_1
    //   83: aload_2
    //   84: iload_3
    //   85: aload 4
    //   87: iload 5
    //   89: invokespecial 60	org/mozilla/javascript/EvaluatorException:<init>	(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V
    //   92: astore 6
    //   94: aload 6
    //   96: areturn
    // Line number table:
    //   Java source line #91	-> byte code offset #0
    //   Java source line #93	-> byte code offset #3
    //   Java source line #94	-> byte code offset #17
    //   Java source line #95	-> byte code offset #19
    //   Java source line #97	-> byte code offset #23
    //   Java source line #98	-> byte code offset #28
    //   Java source line #96	-> byte code offset #47
    //   Java source line #97	-> byte code offset #49
    //   Java source line #98	-> byte code offset #54
    //   Java source line #100	-> byte code offset #70
    //   Java source line #97	-> byte code offset #73
    //   Java source line #98	-> byte code offset #78
    //   Java source line #101	-> byte code offset #94
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	97	0	this	1
    //   0	97	1	message	String
    //   0	97	2	sourceName	String
    //   0	97	3	line	int
    //   0	97	4	lineSource	String
    //   0	97	5	lineOffset	int
    //   1	94	6	exception	EvaluatorException
    //   17	3	7	e	EvaluatorException
    //   47	24	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   3	14	17	org/mozilla/javascript/EvaluatorException
    //   3	23	47	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.JavaScriptMinifier.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import org.mozilla.javascript.ErrorReporter;
import org.mozilla.javascript.EvaluatorException;
import org.slf4j.Logger;

public class JavaScriptMinifier
  extends AbstractMinifier
{
  protected static final String[] JS_FILE_EXTENSIONS = { "js" };
  
  public JavaScriptMinifier()
  {
    super(JS_FILE_EXTENSIONS);
  }
  
  /* Error */
  public void compress(java.io.InputStream source, java.io.OutputStream target)
    throws EvaluatorException, java.io.IOException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aconst_null
    //   3: astore 4
    //   5: new 31	java/io/InputStreamReader
    //   8: dup
    //   9: aload_1
    //   10: invokespecial 33	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   13: astore_3
    //   14: new 36	java/io/OutputStreamWriter
    //   17: dup
    //   18: aload_2
    //   19: invokespecial 38	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;)V
    //   22: astore 4
    //   24: new 41	com/yahoo/platform/yui/compressor/JavaScriptCompressor
    //   27: dup
    //   28: aload_3
    //   29: new 43	org/tizen/web/compressor/minifier/core/JavaScriptMinifier$1
    //   32: dup
    //   33: aload_0
    //   34: invokespecial 45	org/tizen/web/compressor/minifier/core/JavaScriptMinifier$1:<init>	(Lorg/tizen/web/compressor/minifier/core/JavaScriptMinifier;)V
    //   37: invokespecial 48	com/yahoo/platform/yui/compressor/JavaScriptCompressor:<init>	(Ljava/io/Reader;Lorg/mozilla/javascript/ErrorReporter;)V
    //   40: astore 5
    //   42: aload 5
    //   44: aload 4
    //   46: iconst_m1
    //   47: iconst_1
    //   48: iconst_0
    //   49: iconst_1
    //   50: iconst_0
    //   51: invokevirtual 51	com/yahoo/platform/yui/compressor/JavaScriptCompressor:compress	(Ljava/io/Writer;IZZZZ)V
    //   54: goto +34 -> 88
    //   57: astore 5
    //   59: aload 5
    //   61: athrow
    //   62: astore 5
    //   64: aload 5
    //   66: athrow
    //   67: astore 6
    //   69: iconst_2
    //   70: anewarray 54	java/lang/Object
    //   73: dup
    //   74: iconst_0
    //   75: aload_3
    //   76: aastore
    //   77: dup
    //   78: iconst_1
    //   79: aload 4
    //   81: aastore
    //   82: invokestatic 56	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   85: aload 6
    //   87: athrow
    //   88: iconst_2
    //   89: anewarray 54	java/lang/Object
    //   92: dup
    //   93: iconst_0
    //   94: aload_3
    //   95: aastore
    //   96: dup
    //   97: iconst_1
    //   98: aload 4
    //   100: aastore
    //   101: invokestatic 56	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   104: return
    // Line number table:
    //   Java source line #63	-> byte code offset #0
    //   Java source line #64	-> byte code offset #2
    //   Java source line #66	-> byte code offset #5
    //   Java source line #67	-> byte code offset #14
    //   Java source line #68	-> byte code offset #24
    //   Java source line #106	-> byte code offset #42
    //   Java source line #107	-> byte code offset #57
    //   Java source line #108	-> byte code offset #59
    //   Java source line #109	-> byte code offset #62
    //   Java source line #110	-> byte code offset #64
    //   Java source line #111	-> byte code offset #67
    //   Java source line #112	-> byte code offset #75
    //   Java source line #113	-> byte code offset #85
    //   Java source line #111	-> byte code offset #88
    //   Java source line #112	-> byte code offset #94
    //   Java source line #114	-> byte code offset #104
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	105	0	this	JavaScriptMinifier
    //   0	105	1	source	java.io.InputStream
    //   0	105	2	target	java.io.OutputStream
    //   1	94	3	reader	java.io.InputStreamReader
    //   3	96	4	writer	java.io.OutputStreamWriter
    //   40	3	5	compressor	com.yahoo.platform.yui.compressor.JavaScriptCompressor
    //   57	3	5	e	EvaluatorException
    //   62	3	5	e	java.io.IOException
    //   67	19	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   5	54	57	org/mozilla/javascript/EvaluatorException
    //   5	54	62	java/io/IOException
    //   5	67	67	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.JavaScriptMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.util.IOUtil;

public class Minifier
{
  protected final Logger logger = LoggerFactory.getLogger(getClass());
  protected final Set<IMinifier> minifiers = new HashSet();
  
  public boolean canHandle(String name)
  {
    logger.debug("Name: {}, Minifiers: {}", name, minifiers);
    for (IMinifier minifier : minifiers) {
      if (minifier.canHandle(name)) {
        return true;
      }
    }
    return false;
  }
  
  public void addMinifier(IMinifier minifier)
  {
    minifiers.add(minifier);
  }
  
  public void compress(String name, InputStream in, OutputStream out)
    throws Exception
  {
    boolean bProcess = false;
    byte[] bytes = IOUtil.getBytes(in, true);
    logger.debug("Minifiers: {}", minifiers);
    for (IMinifier minifier : minifiers)
    {
      logger.trace("Minifier: {}", minifier);
      if (minifier.canHandle(name))
      {
        ByteArrayInputStream byteIn = new ByteArrayInputStream(bytes);
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        minifier.compress(byteIn, byteOut);
        bytes = byteOut.toByteArray();
        bProcess = true;
      }
    }
    if (!bProcess) {
      throw new Exception(name + " is not supported file.");
    }
    if (out != null) {
      out.write(bytes);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.Minifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.compressor.minifier.core;

import com.googlecode.htmlcompressor.compressor.XmlCompressor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.tizen.common.util.IOUtil;

public class XMLMinifier
  extends AbstractMinifier
  implements IMinifier
{
  protected static final String[] XML_FILE_EXTENSIONS = { "xml" };
  
  public XMLMinifier()
  {
    super(XML_FILE_EXTENSIONS);
  }
  
  public void compress(InputStream source, OutputStream target)
    throws IOException
  {
    XmlCompressor compressor = new XmlCompressor();
    
    String compressedXml = compressor.compress(IOUtil.getString(source, true));
    target.write(compressedXml.getBytes());
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.compressor.minifier.core.XMLMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd