BufferedReader reset fail after read to end of file

后端 未结 2 1595
南方客
南方客 2021-01-21 22:58

I have a BufferedReader wrapped on a file, I want to mark a place and use reset() later to get back to this position. I have read the java api, it states mark (readlimit), when

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-21 23:45

    large but not as large as file

    This is the problem. Make it as large, or larger. You can't reset further back than the mark quantum.

    But you shouldn't have to re-read files at all, this is poor design and poor programming. Compilers can compile programs by only reading source files once, and compilation is a lot more complex than any process you have to carry out.

提交回复
热议问题