I’m saving some Java objects in files. I seralize them that way : Class Timestamp.java: Class ObjId.java: CachedObj.java : The rest of my code : In another place in my code I deserialize that way : And I have a function that calculates an CachedObj object size : My question is, when I run the following code : Why are
Tag: objectinputstream
How to Serialize and Deserialize multiple objects in Java during runtime
I am creating a Login Form and Sign up Form using JFrames. The problem is every time when the user presses the Sign up button the user details should be serialized and added to the “users.ser” file. And if the user presses the Login button it has to deserialize the data from that file and check for granting access to
ObjectInputStream readObject in while Loop
Is it possible to read from ObjectInputStream in while loop which will terminate by exception thrown by socket timeout socket.setSoTimeout(4000); Answer When you say ‘not working’, what you really mean is ‘not compiling’, for reasons that are stated in the compiler message: Object isn’t a boolean expression, and you can’t declare a variable in a while condition. However the code