aeroson

Untitled

Oct 17th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package javaapplication1;
  6.  
  7. import java.io.BufferedReader;
  8. import java.io.File;
  9. import java.io.FileNotFoundException;
  10. import java.io.FileReader;
  11. import java.io.FileWriter;
  12. import java.io.IOException;
  13.  
  14. /**
  15. *
  16. * @author a
  17. */
  18. public class JavaApplication1 {
  19.  
  20. /**
  21. * @param args the command line arguments
  22. */
  23. final static int BS=2048;
  24. static char[] cbuf=new char[BS];
  25.  
  26. public static void main(String[] args) throws FileNotFoundException, IOException {
  27.  
  28. String s="in.txt";
  29.  
  30.  
  31. File f=new File(s);
  32. long size=f.length();
  33. long total=0;
  34.  
  35. FileWriter o= new FileWriter("out.txt");
  36. BufferedReader b=new BufferedReader(new FileReader(s));
  37. String last="";
  38. do {
  39. int len=b.read(cbuf, 0, BS);
  40. String str=new String(cbuf).substring(0, len).toLowerCase();
  41. total+=len;
  42. do {
  43. str=str.replaceAll("bug", "");
  44. } while (str.contains("bug"));
  45. System.out.print(str);
  46. o.write(str);
  47. o.flush();
  48. } while (total<size);
  49. o.close();
  50.  
  51. System.out.print("end");
  52.  
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment