Equivalent of BufferedReader.readNext() for ObjectInputStream in Java?

There is ObjectInputStream#readObject() and you can also combine ObjectInputStream with a BufferedInputStream.

Up vote 1 down vote favorite share g+ share fb share tw.

I have a Server communicating with multiple clients through a socket connection. In my original program, messages were sent and recieved using a PrintWriter and a BufferedReader. When I checked to see if any new messages had been received, the BufferedReader would have them all stored and I could read them one by one.

I am now trying to do the same thing, but sending across objects rather than text with an ObjectOutputStream and an ObjectInputStream. However, when the the client or server receives more than one message before checking for new messages, it only processes one of them. Is there a way that I can have a method similar to BufferedReader.readNext(), but for an ObjectInputStream?

Is there a better way to send objects across? Or is there be a way to make a listener that responds each time a new message is received? Thanks java buffering objectoutputstream objectinputstream link|improve this question asked Oct 12 '10 at 2:17omnipotentperson82.

Okay, thanks. That is exactly what I needed. – omnipotentperson Oct 12 '10 at 2:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions