Add Parser class
This commit is contained in:
parent
3f664c8099
commit
300b7b78ee
|
@ -1 +1,6 @@
|
|||
data
|
||||
target
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
output
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -29,6 +29,11 @@
|
|||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>8.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package org.RI.P2;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Parser {
|
||||
private static List<File> files;
|
||||
|
||||
private static void readFiles(String directory) throws IOException {
|
||||
files = Files.walk(Paths.get(directory)).filter(Files::isRegularFile).map(Path::toFile)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static void usage() {
|
||||
System.out.println("Usage: Parser <directory>");
|
||||
System.out.println("option directory: directory that contains JSON files");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length != 1) {
|
||||
usage();
|
||||
}
|
||||
String directory = args[0];
|
||||
readFiles(directory);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue