The exception you get is because you are trying to cast a FileInputStream
instance to ObjectInputStream
, but this is not the way it works, you have to wrap it:
final ObjectInputStream os = new ObjectInputStream(is);
entry.responseHeaders = readStringStringMap(os);
The exception says that your is
parameter is actually a FileInputStream
, but you don't have to deal with that: it's enough to know that it is an InputStream
implementation, so you can use it in the ObjectInputStream
constructor.