/ Published in: Java
The given utility class can be used to serialize and deserialize java objects
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package serialize; import java.io.IOError; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; public class IOUtils { try { stream.writeObject(obj); throw new IOError(e); } } try { T obj = c.cast(stream.readObject()); return obj; throw new IOError(e); throw new IOError(e); } } }