Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int num_of_lines(){
- int count=0;
- Process p1;
- Process p2;
- String s;
- String s1[];
- s="git -C "+path+" ls-files";
- try{
- p1=Runtime.getRuntime().exec(s);
- BufferedReader br1 = new BufferedReader(new InputStreamReader(p1.getInputStream()));
- while ((s = br1.readLine()) != null){
- try{
- p2=Runtime.getRuntime().exec("wc -l "+path+"/"+s);
- BufferedReader br2=new BufferedReader(new InputStreamReader(p2.getInputStream()));
- s=br2.readLine();
- s1=s.split(" ");
- count += Integer.parseInt(s1[0]);
- p2.waitFor();
- p2.destroy();
- }catch(Exception e){}
- }
- p1.waitFor();
- p1.destroy();
- }catch(Exception e){}
- return count ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement