本文整理汇总了Java中com.x5.template.Chunk.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.toString方法的具体用法?Java Chunk.toString怎么用?Java Chunk.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.x5.template.Chunk
的用法示例。
在下文中一共展示了Chunk.toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderIndex
import com.x5.template.Chunk; //导入方法依赖的package包/类
public String renderIndex(final LogFiles logFiles, final PidDatabase database) {
final List<HashMap<String, String>> processes = database.runningProcesses();
final Chunk chunk = mTheme.makeChunk("index");
final TreeMultimap<Long, File> files = logFiles.list();
final ArrayList<HashMap<String, String>> encodedFiles = new ArrayList<>(files.size());
long totalSize = 0;
for (final File file : files.values()) {
final HashMap<String, String> content = new HashMap<>(5);
final long fileSize = file.length();
final String name = file.getName();
final int pid = database.findPid(name);
content.put("file_name", name);
content.put("last_modified", String.valueOf(file.lastModified()));
content.put("file_size", String.valueOf(fileSize));
if (pid != -1) {
content.put("pid", String.valueOf(pid));
content.put("process_name", database.getProcessName(pid));
}
encodedFiles.add(content);
totalSize += fileSize;
}
chunk.set("files", encodedFiles);
chunk.set("total_size", String.valueOf(totalSize));
chunk.set("processes", processes);
return chunk.toString();
}
示例2: renderSettings
import com.x5.template.Chunk; //导入方法依赖的package包/类
public String renderSettings(final Preferences preferences) {
final Chunk chunk = mTheme.makeChunk("settings");
chunk.put("filter", preferences.getFilter().pattern());
chunk.put("filesize", String.valueOf(preferences.getPurgeFilesize()));
chunk.put("date", String.valueOf(preferences.getPurgeDuration()));
chunk.put("show_indicator", String.valueOf(preferences.shouldShowIndicator()));
chunk.put("split_size", String.valueOf(preferences.getSplitSize()));
chunk.put("run_on_boot", String.valueOf(preferences.shouldRunOnBoot()));
return chunk.toString();
}
示例3: renderFilterSettings
import com.x5.template.Chunk; //导入方法依赖的package包/类
public String renderFilterSettings(final Preferences preferences) {
final Chunk chunk = mTheme.makeChunk("filters");
chunk.put("filter", preferences.getFilter().pattern());
chunk.put("log_filter", preferences.getRawLogFilter());
if (preferences.hasDefaultLogFilter()) {
chunk.put("log_filter_use_default", "true");
}
return chunk.toString();
}
示例4: renderSettingsError
import com.x5.template.Chunk; //导入方法依赖的package包/类
public String renderSettingsError(final String source, final String title, final Throwable e) {
final Chunk chunk = mTheme.makeChunk("settings_error");
chunk.put("title", title);
chunk.put("source", source);
if (e != null) {
chunk.put("message", e.getLocalizedMessage());
}
return chunk.toString();
}
示例5: renderLive
import com.x5.template.Chunk; //导入方法依赖的package包/类
public String renderLive() {
final Chunk chunk = mTheme.makeChunk("live");
return chunk.toString();
}
示例6: getContent
import com.x5.template.Chunk; //导入方法依赖的package包/类
@Override
protected String getContent() throws IOException
{
Chunk chunk = buildChunk();
return chunk.toString();
}