I want to make it so I can call in.mark(512)
to limit my stream to 512 bytes. Then, later I want to limit my stream to 64 bytes. Can I later call in.mark(64)
and then in.reset()
but still have the mark of 512 be active? What I'm trying to say is "Can you have a mark()
and reset()
stack?"
At least for BufferedInputStream, the answer is definitely no. It stores marklimit
and markpos
fields, which are just simple ints.
You could probably write one, but the functionality is not in the base Java streams.
Sure, that is what inheritance is for. Extend whatever stream class you are working with and overload the mark and reset methods.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.