Yes, the default Java serialization works for cyclic references. When you serialize object C, the field will contain a backreference to the already-serialized object A instead of serializing it again.
What file extension would be most suitable when saving a Serializable object to disk?
FileOutputStream fos = null;
ObjectOutputStream out = null;
try {
fos = new FileOutputStream(filename);
out = new ObjectOutputStream(fos);
out.writeObject(mySerializableObject);
} catch (IOException ex) {
ex.printStackTrace();
} finally {
IOUtils.closeQuietly(…
I have the following class:
import java.awt.Color;
import java.util.Vector;
public class MyClass {
private ImageSignature imageSignature;
private class ImageSignature implements Serializable {
private static final long serialVersionUID = -6552319171850636836L;
private Vector<Color> colors = new Vector<…