本文整理汇总了Java中de.invation.code.toval.file.FileReader类的典型用法代码示例。如果您正苦于以下问题:Java FileReader类的具体用法?Java FileReader怎么用?Java FileReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileReader类属于de.invation.code.toval.file包,在下文中一共展示了FileReader类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import de.invation.code.toval.file.FileReader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public GraphicalPTNet parse(File file) throws IOException, ParserException {
GraphicalPTNet net = new GraphicalPTNet();
FileReader reader = new FileReader(file.getAbsolutePath());
String nextLine;
while ((nextLine = reader.readLine()) != null) {
String lineContent;
if (nextLine.startsWith(PREFIX_COMMENT)) {
// Do nothing
} else if (nextLine.startsWith(PREFIX_OUTPUTS)) {
lineContent = nextLine.replace(PREFIX_OUTPUTS, "");
insertTransitions(net.getPetriNet(), lineContent);
} else if (nextLine.isEmpty() || nextLine.startsWith(PREFIX_GRAPH) || nextLine.startsWith(PREFIX_END)) {
// Do nothing
} else if (nextLine.startsWith(PREFIX_CAPACITIES)) {
lineContent = nextLine.replace(PREFIX_CAPACITIES, "");
setCapacities(net.getPetriNet(), lineContent);
} else if (nextLine.startsWith(PREFIX_MARKING)) {
lineContent = nextLine.replace(PREFIX_MARKING, "");
lineContent = lineContent.replace("{", "");
lineContent = lineContent.replace("}", "");
setMarking(net.getPetriNet(), lineContent);
} else {
addFlowRelation(net.getPetriNet(), nextLine);
}
}
reader.closeFile();
return net;
}
示例2: TraceWiseXesIterator
import de.invation.code.toval.file.FileReader; //导入依赖的package包/类
/**
* Creates a new TraceWiseXesIterator with the specified fragment size.
*
* @param logFile
* Path to the log file to read
* @param fragmentSize
* The number of traces for the iterator
* @throws IOException
*/
public TraceWiseXesIterator(String logFile, int fragmentSize) throws ParameterException, IOException {
Validate.exists(logFile);
Validate.positive(fragmentSize);
fileReader = new FileReader(logFile);
header = nextStringFragment();
this.fragmentSize = fragmentSize;
}