Fix action argument string matching
This commit is contained in:
parent
0f688eaf42
commit
bada55444e
|
@ -26,18 +26,30 @@ public class AnalyzeDirectory {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void chooseAction(String action) {
|
private static void getMetadata() throws IOException, TikaException, SAXException {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
FileData data = new FileData(file);
|
FileData data = new FileData(file);
|
||||||
if (action == "metadata") {
|
|
||||||
System.out.println(data);
|
System.out.println(data);
|
||||||
} else if (action == "links") {
|
System.out.println("--------------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void getAllLinks() throws IOException, TikaException, SAXException {
|
||||||
|
for (File file : files) {
|
||||||
|
FileData data = new FileData(file);
|
||||||
data.getLinks();
|
data.getLinks();
|
||||||
|
System.out.println("--------------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void chooseAction(String action) throws IOException, TikaException, SAXException {
|
||||||
|
if (action.equals("metadata")) {
|
||||||
|
getMetadata();
|
||||||
|
} else if (action.equals("links")) {
|
||||||
|
getAllLinks();
|
||||||
} else {
|
} else {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
System.out.println("--------------------------------------------------------------------------");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException, TikaException, SAXException {
|
public static void main(String[] args) throws IOException, TikaException, SAXException {
|
||||||
|
@ -45,8 +57,9 @@ public class AnalyzeDirectory {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
String directory = args[0];
|
String directory = args[0];
|
||||||
|
String action = args[1];
|
||||||
readFiles(directory);
|
readFiles(directory);
|
||||||
chooseAction(args[1]);
|
chooseAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue