本文整理汇总了Java中com.fizzed.rocker.runtime.DefaultRockerModel类的典型用法代码示例。如果您正苦于以下问题:Java DefaultRockerModel类的具体用法?Java DefaultRockerModel怎么用?Java DefaultRockerModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultRockerModel类属于com.fizzed.rocker.runtime包,在下文中一共展示了DefaultRockerModel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transfer
import com.fizzed.rocker.runtime.DefaultRockerModel; //导入依赖的package包/类
/**
* This is a default method used by all generators to transfer a template into a generated
* file into the right location.
*
* @param folder The output folder of the project
* @param path Current file path in the output folder
* @param filename Current filename in the output folder
* @param rockerModel The rocker template class compiled from the template for this file.
* @throws IOException throws IOException
*/
default void transfer(String folder, String path, String filename, DefaultRockerModel rockerModel) throws IOException {
String absPath = folder + (path.isEmpty()? "" : separator + path);
if(Files.notExists(Paths.get(absPath))) {
Files.createDirectories(Paths.get(absPath));
}
try(FileOutputStream fos = new FileOutputStream(absPath + separator + filename);
ReadableByteChannel rbc = rockerModel.render(ArrayOfByteArraysOutput.FACTORY).asReadableByteChannel()) {
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
}
}
示例2: render
import com.fizzed.rocker.runtime.DefaultRockerModel; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String render(final Object o) throws Exception {
return ((DefaultRockerModel) o).render().toString();
}