I’m having a software who is doing a http GET request and then I am receiving an HttpEntity response.
This is fine to me. The problem is that I want to use read this response 2 times and I dont know which way is the best.
If I convert the entity to a string, then when I try to access again the entity, Im getting an exception that the entity has been consumed.
If I try to use the getContent method to use the InputStream I dont find a way to reread the inputStream 2 times as i need.
Can someone tell me how I can save the httpEntity result as a way I can reuse it twice ?? Shoud I create a file ? How I do that ? What about performance to write a file each time I do a GET ? How to delete that file on each call ? Where to save the file ?
If you have any other ideas, thanks for the help.
I will appreciate code examples.
I finally found how to convert a stream to a string so I did the following thing :