Currently I am using an ObjecInputStream to read from a Socket, and everything works fine using this simple code:
ObjectInputStream input = new ObjectInputStream(socket.getInputStream());
Object response = input.readObject();
Now I want to somehow cancel the read, without closing the stream, so that I can later read from it again. Is it possible?
Edit: I want to cancel the read just because it is blocking the program flow. I don't need to read the same information twice. I just want to cancel it so that I can send another request and then read the (another) response.