Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ObjectInputStream  RSS feed

 
Nirmal Mekala Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we check if an ObjectInputStream is ready to be read. It does not have methods like ready() as in readers, so how do I check it.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the ObjectInputStream API Doc and you'll see a method called available() that may do what you require.
 
Nirmal Mekala Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried available but it blocks indefinitely(while(!(available>0)){}) When I remove it, the program moves forward and reads from the objectstream.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!