【发布时间】:2019-07-19 14:29:39
【问题描述】:
Asterisk 在 java 中可以工作吗?我想读取带有时间戳的文件。 taxonomy_timestamp.txt 但它不起作用。
String fileName = "20190215/"+"taxonomy_*.txt";
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
String line;
while ((line = reader.readLine()) != null) {
if(line.contains(":")) {
String[] segmentData = line.split(":");
String keyword = segmentData[0];
String name = segmentData[1];
segmentList.add(new ExternalSegmentDownloader.ExternalSegmentKey(keyword, name));
}
}
}catch(IOException e){
log.info("File not found.",e);
}
return segmentList;
}
【问题讨论】:
-
您遇到什么错误?你能用文件名更新完整路径吗
-
我没有文件名。文件的前缀是taxonomy_,扩展名为txt。但时间戳会在前缀之后。