readLine无法正确读取文件?

时间:2015-03-22 06:48:11

标签: java

我有以下代码但是当我从输入读取时,输入未正确读取。输入是两行代码,但是如果第一行太大(100万个字符)则无法正确读取

package usaco;
import java.io.*;
import java.util.*;

public class Censoring {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new FileReader(("C:/Users/Eric Gan/workspace/12in.txt")));
        PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("C:/Users/Eric Gan/workspace/myout.txt")));
        String input = br.readLine();
        String censor = br.readLine();

        br.close();

        pw.println(input);
        pw.close();

        System.out.println(input);
        System.out.println(censor);

        while(input.contains(censor))
            {
                input = input.replace(censor, "");
            }

    }
}

0 个答案:

没有答案