SpeedTest.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
@Override
protected void setUp() throws Exception {
    clearWorkDir();

    FileWriter w = new FileWriter(new File(getWorkDir(), "template.txt"));
    w.write("<html><h1>${title}</h1></html>");
    w.close();


    parameters = new HashMap<String,String>();
    parameters.put("title", "SOME_TITLE");

    LocalFileSystem lfs = new LocalFileSystem();
    lfs.setRootDirectory(getWorkDir());
    fo = lfs.findResource("template.txt");


    ScriptEngineManager mgr = new ScriptEngineManager();
    eng = mgr.getEngineByName("freemarker");
    assertNotNull("We do have such engine", eng);
    eng.getContext().setAttribute(FileObject.class.getName(), fo, ScriptContext.ENGINE_SCOPE);
    eng.getContext().getBindings(ScriptContext.ENGINE_SCOPE).putAll(parameters);

    whereTo = new File[10000];
    for (int i = 0; i < whereTo.length; i++) {
        whereTo[i] = new File(getWorkDir(), "outFile"+i+".txt");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号