The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

readObject() Method.

Posted by Oha on February 14, 2002 at 12:05 PM

I am trying to use the readObject() method inside a while loop to read in a vector.

while(true){
try{....
input = (Vector)is.readObject();}

The problem is that the vector is read in on the first pass through the loop correctly. But on the next passes the vector "input" does not change even though I am sending in different values.
If I did exactly the same thing but using a string in place of the vector, the string is updated correctly all the time. Is there something wrong with using the vector and readObject() method in a loop.
I need to update the vector each time when passing through the loop using the readObject() method.
If you wrote a simple client/server application with the readObject() method inside a while loop, passing a vector, you will see that the vector is not updated and no errors are thrown either.
I am using JDK1.3 on WinNT.

Thanks for your time,

Victor.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us