public static void parseInput(String inputFile, ProductMatcher pMatcher, int option) { try { if (inputFile == null) { return; } FileInputStream fstream = new FileInputStream(inputFile); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; // Read File Line By Line while ((strLine = br.readLine()) != null) { // parse the json string and create related objects such as Products, Manufacturer and // Listing. if (option == 0) pMatcher.parseProduct(strLine); if (option == 1) pMatcher.parseListing(strLine); } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } }