本文整理匯總了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();
}