FileDocCategorySizeDatePackage
SerialCtl.javaAPI DocExample3722Mon Apr 06 18:10:24 BST 1998None

SerialCtl

public class SerialCtl extends Object implements Serializable

Fields Summary
String
a
transient String
b
Constructors Summary
public SerialCtl(String aa, String bb)

    a = "Not Transient: " + aa;
    b = "Transient: " + bb;
  
Methods Summary
public static voidmain(java.lang.String[] args)

    SerialCtl sc = 
      new SerialCtl("Test1", "Test2");
    System.out.println("Before:\n" + sc);
    ByteArrayOutputStream buf = 
      new ByteArrayOutputStream();
    try {
      ObjectOutputStream o =
        new ObjectOutputStream(buf);
      o.writeObject(sc);
      // Now get it back:
      ObjectInputStream in =
        new ObjectInputStream(
          new ByteArrayInputStream(
            buf.toByteArray()));
      SerialCtl sc2 = (SerialCtl)in.readObject();
      System.out.println("After:\n" + sc2);
    } catch(Exception e) {
      e.printStackTrace();
    }
  
private voidreadObject(java.io.ObjectInputStream stream)

    stream.defaultReadObject();
    b = (String)stream.readObject();
  
public java.lang.StringtoString()

    return a + "\n" + b;
  
private voidwriteObject(java.io.ObjectOutputStream stream)

    stream.defaultWriteObject();
    stream.writeObject(b);