Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication1;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- /**
- *
- * @author a
- */
- public class JavaApplication1 {
- /**
- * @param args the command line arguments
- */
- final static int BS=2048;
- static char[] cbuf=new char[BS];
- public static void main(String[] args) throws FileNotFoundException, IOException {
- String s="in.txt";
- File f=new File(s);
- long size=f.length();
- long total=0;
- FileWriter o= new FileWriter("out.txt");
- BufferedReader b=new BufferedReader(new FileReader(s));
- String last="";
- do {
- int len=b.read(cbuf, 0, BS);
- String str=new String(cbuf).substring(0, len).toLowerCase();
- total+=len;
- do {
- str=str.replaceAll("bug", "");
- } while (str.contains("bug"));
- System.out.print(str);
- o.write(str);
- o.flush();
- } while (total<size);
- o.close();
- System.out.print("end");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment