I have a senario, where i have to read the input stream first to make a md5 calculation, after this, i have to call a other program with the stream....
My problem is after tje md5 calculation, the stream is at the end.
I have tried to mark and reset the inputstream, but this is not supported.
One option would be to calculate the MD5 sum while reading the contents, but if that's not possible then you have no choice but to store the contents in memory. The easiest way is to use a ByteArrayOutputStream to write to. Afterwards, you get the byte[] back from it and wrap it in a ByteArrayInputStream.