I want to read an input stream twice but after the first usage, the stream gets closed and I am not able to use it again. CloseShieldInputStream also doesn't seem to help. Can someone please help me with this?
Asked
Active
Viewed 1,639 times
0
-
Which language are you working in? What have you tried till now? Show us the code. – Sujit Agarwal Aug 06 '18 at 13:50
-
It's java. basically I am detecting the mime type and length of the input stream and then I am supposed to pass it to the output stream. The signature of the method is something like this : public void execute(InputStream input, OutputStream output) – Prabhat Aug 07 '18 at 09:19
-
After detecting the MIME type and length, do you want to process the _remainder_ of the stream? Or do you want to start reading it from the very beginning again? – DodgyCodeException Aug 08 '18 at 09:46
-
1Have a look at this question: https://stackoverflow.com/questions/924990/how-to-cache-inputstream-for-multiple-use – Herr Derb Aug 08 '18 at 10:04