Given a Java InputStream, how can I determine the current offset in the stream?

后端 未结 4 2144
轻奢々
轻奢々 2020-12-01 18:30

I\'d like something like a generic, re-usable getPosition() method that will tell me the number of bytes read from the starting point of the stream. Ideally, I

4条回答
  •  孤街浪徒
    2020-12-01 19:06

    No. InputStream is intended to handle potentially infinite amounts of data, so a counter would get in the way. In addition to wrapping them all, you might be able to do something with aspects.

提交回复
热议问题