Code example for ObjectInputStream

Methods: readDouble

0
   * @throws ClassNotFoundException if serialized object class cannot be found. 
   */ 
  public Object readObject(final ObjectInputStream in)
      throws IOException, ClassNotFoundException 
  { 
    final double w = in.readDouble();
    final double h = in.readDouble();
    return new FloatDimension((float) w, (float) h);
  } 
 
  /** 
   * Returns the class of the object, which this object can serialize. 
   * 
   * @return the class of java.awt.geom.Dimension2D. 
   */ 
  public Class getObjectClass()
  { 
    return Dimension2D.class; 
  } 
}