Code example for ObjectStreamField

0
 
    private static final long serialVersionUID = 1L;
     
    private static final ObjectStreamField[] serialPersistentFields = {
        new ObjectStreamField("i", Integer.class, true),
        new ObjectStreamField("d", Date.class, false),
        new ObjectStreamField("s", String.class, true),
    }; 
     
    private ObjectInputStream.GetField getField;
     
    public static Date today = new Date(1172632429156l);
     
    public ObjectInputStream.GetField getGetField() {
        return getField;
    } 
     
    private void writeObject(ObjectOutputStream o) throws IOException {
        ObjectOutputStream.PutField putField = o.putFields();
        putField.put("i", new Integer(1000));
        putField.put("d", today);