public void interupt() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { br.readLine(); } catch (Exception e) { } }
public static String readFileToString(String filePath) throws IOException { StringBuilder fileData = new StringBuilder(1000); BufferedReader reader = new BufferedReader(new FileReader(filePath)); char[] buf = new char[10]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { // System.out.println(numRead); String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } reader.close(); return fileData.toString(); }
public static void main(String[] args) { hadoop_Training3_CATCH demo = new hadoop_Training3_CATCH(); demo.conn = demo.initdb(demo.db_name); if (demo.conn == null) { System.out.println(" Databasse connection is null"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { br.readLine(); } catch (Exception e) { } } // create new file for every run try { BufferedWriter bw = new BufferedWriter(new FileWriter(demo.logged_file_path)); bw.close(); bw = new BufferedWriter(new FileWriter(demo.non_logged_file_path)); bw.close(); } catch (IOException e1) { e1.printStackTrace(); } try { BufferedReader br = new BufferedReader(new FileReader(demo.listing_file_path)); String file_name = br.readLine(); while (br != null) { System.out.println("Parsing File=" + file_name); int len = (file_name.split("\\\\")).length; demo.package_name = file_name.split("\\\\")[len - 2]; demo.temp_file_path = file_name.replace("\\", "\\\\"); // demo.id = 0; demo.ast_prser(file_name); file_name = br.readLine(); // br=null; } } catch (FileNotFoundException e) { System.out.println("Error.. Can not open the listing file"); e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public static void main(String[] args) { cloudstack_Training2_IF demo = new cloudstack_Training2_IF(); demo.conn = demo.initdb(demo.db_name); try { BufferedReader br = new BufferedReader(new FileReader(demo.listing_file_path)); String file_name = br.readLine(); while (br != null) { System.out.println("Parsing File=" + file_name); int len = (file_name.split("\\\\")).length; demo.package_name = file_name.split("\\\\")[len - 2]; demo.temp_file_path = file_name; // // demo.id = 0; demo.ast_prser(file_name); file_name = br.readLine(); // br=null; } } catch (FileNotFoundException e) { System.out.println("Error.. Can ot open the listing file"); e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }