Fix JSON parser function
This commit is contained in:
parent
c61932d99d
commit
2cb004c6d0
|
@ -45,10 +45,13 @@ public class Indexer {
|
||||||
|
|
||||||
JSONArray parseJSONFile(String filePath) throws IOException, ParseException {
|
JSONArray parseJSONFile(String filePath) throws IOException, ParseException {
|
||||||
InputStream jsonFile = getClass().getResourceAsStream(filePath);
|
InputStream jsonFile = getClass().getResourceAsStream(filePath);
|
||||||
|
JSONArray parseJSONFile(File file) throws IOException {
|
||||||
|
InputStream jsonFile = new FileInputStream(file);
|
||||||
Reader readerJson = new InputStreamReader(jsonFile);
|
Reader readerJson = new InputStreamReader(jsonFile);
|
||||||
Object fileObjects = JSONValue.parse(readerJson);
|
Object fileObject = JSONValue.parse(readerJson);
|
||||||
JSONArray arrayObjects = (JSONArray) fileObjects;
|
JSONArray arrayObject = new JSONArray();
|
||||||
return arrayObjects;
|
arrayObject.add(fileObject);
|
||||||
|
return arrayObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
void openIndex() throws IOException {
|
void openIndex() throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue