Reading huge line of string from text file

前端 未结 6 2034
南旧
南旧 2020-12-06 15:27

I have a large text file but doesn\'t have any line break. It just contains a long String (1 huge line of String with all ASCII characters), but so far anything works just f

6条回答
  •  一整个雨季
    2020-12-06 16:02

    To read chunks from file or write same to some file this could be used:

    {
    in = new FileReader("input.txt");
    out = new FileWriter("output.txt");
    char[] buffer = new char[1024];
    int l = 0;
    while ( (l = in.read(buffer)) > 0 ) {
        out.write(buffer, 0, l);
    }
    

提交回复
热议问题