diff --git a/.gitignore b/.gitignore index 1269488..333cddd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ data +target +.classpath +.project +.settings +output diff --git a/pom.xml b/pom.xml index aa1e560..9e75a55 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,11 @@ lucene-analyzers-common 8.6.3 + + com.googlecode.json-simple + json-simple + 1.1.1 + diff --git a/src/main/java/org/RI/P2/Parser.java b/src/main/java/org/RI/P2/Parser.java new file mode 100644 index 0000000..642b190 --- /dev/null +++ b/src/main/java/org/RI/P2/Parser.java @@ -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 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 "); + 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); + } +}