当前位置: 首页>>代码示例>>Java>>正文


Java Main类代码示例

本文整理汇总了Java中org.mozilla.javascript.tools.shell.Main的典型用法代码示例。如果您正苦于以下问题:Java Main类的具体用法?Java Main怎么用?Java Main使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Main类属于org.mozilla.javascript.tools.shell包,在下文中一共展示了Main类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runFileIfExists

import org.mozilla.javascript.tools.shell.Main; //导入依赖的package包/类
private static void runFileIfExists(Context cx, Scriptable global, File f)
{
    if(f.isFile())
    {
        Main.processFile(cx, global, f.getPath());
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:8,代码来源:ShellTest.java

示例2: compressJavaScript

import org.mozilla.javascript.tools.shell.Main; //导入依赖的package包/类
public String compressJavaScript(final String source) throws Exception
{
    final Exception[] thrown = new Exception[1];
    String reply = (String) Main.shellContextFactory.call(new ContextAction()
    {
        public Object run(Context cx)
        {
            try
            {
                // The shrinksafe Compressor only obfuscates the javascript. Line breaks are removed
                // by the dojo build. Adding the removal of line breaks to make the optimization that
                // would come from using the dojo build. See
                // http://svn.dojotoolkit.org/src/tags/release-1.5.0/util/buildscripts/jslib/buildUtil.js
                // in the buildUtil.optimizeJs function which has the following:
                // if(optimizeType.indexOf("shrinksafe") == 0 || optimizeType == "packer"){
                //     //Apply compression using custom compression call in Dojo-modified rhino.
                //     fileContents = new String(Packages.org.dojotoolkit.shrinksafe.Compressor.compressScript(fileContents, 0, 1, stripConsole));
                //     if(optimizeType.indexOf(".keepLines") == -1){
                //         fileContents = fileContents.replace(/[\r\n]/g, "");
                //     }
                // }
                String obfuscated = org.dojotoolkit.shrinksafe.Compressor.compressScript(source, 0, 1, false, null);
                return obfuscated.replaceAll("[\\r\\n]", "");
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
                thrown[0] = ex;
            }
            return null;
        }
    });

    if (thrown[0] != null)
    {
        throw thrown[0];
    }
    else
    {
        return reply;
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:43,代码来源:ShrinkSafeCompressor.java

示例3: runFileIfExists

import org.mozilla.javascript.tools.shell.Main; //导入依赖的package包/类
private static void runFileIfExists(Context cx, Scriptable global, File f) {
    if(f.isFile()) {
        Main.processFileNoThrow(cx, global, f.getPath());
    }
}
 
开发者ID:F43nd1r,项目名称:rhino-android,代码行数:6,代码来源:ShellTest.java


注:本文中的org.mozilla.javascript.tools.shell.Main类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。