writeObject « API « Java I/O Q&A





1. writeObject writes rubbish    coderanch.com

Thanks, after some further reading I did find that the file is supposed to look that and I'm supposed to be able to read it back using readObject but when I try to use readObject, I get nothing. Here's the test code. Write; FileOutputStream out = new FileOutputStream("theTime"); ObjectOutputStream s = new ObjectOutputStream(out); s.writeObject("Today"); s.writeObject(new Date()); s.flush() read; FileInputStream in = ...

2. Problem using ObjectOutputStreams writeObject(), heeelp.    coderanch.com

When I call networkOut.writeObject(storage) bellow nothing happens. No exception or nothing, the program just seems to freeze at this point. The storage object contains a byte [] array with a soundsnippet recorded from the computers microphone. Any thought will be appreciated, since Im clueless. Thanks in advance. -------- import java.io.*; import java.net.*; public class OutputThread implements Runnable { private Socket socket; ...

3. writeObject OR writeUTF    coderanch.com

4. How it works when we implement writeObject and readObject    coderanch.com

Please refer the below program: import java.io.*; class Collar { private int collarSize = 1; Collar(int cs){ collarSize = cs; } public void setCollarSize(int cs){ this.collarSize = cs; } public int getCollarSize(){ return collarSize; } } class Dog implements Serializable{ private transient Collar cObj = new Collar(10); private int dogSize = 10; Dog(Collar c, int ds){ this.cObj = c; this.dogSize = ...