java file input with rewind()/reset() capability

后端 未结 9 1606
时光说笑
时光说笑 2020-12-03 00:53

I need to write a function that takes in some kind of input stream thing (e.g. an InputStream or a FileChannel) in order to read a large file in two passes: once to precompu

9条回答
  •  一整个雨季
    2020-12-03 01:22

    What you want is RandomAccessFileInputStream - implements InputStream interface with mark/reset, sometimes seek based on RandomAccessFiles. Some implementations exist which might do what you need.

    One example complete with sources is in http://www.fuin.org/utils4j/index.html but you would find many others searching the internet and its is easy enough to code if none fits exactly.

提交回复
热议问题