Code example for ObjectInputStream

Methods: readDouble

   * @throws ClassNotFoundException if serialized object class cannot be found. 
  public Object readObject (final ObjectInputStream in)
          throws IOException, ClassNotFoundException 
    final double x1 = in.readDouble();
    final double y1 = in.readDouble();
    final double x2 = in.readDouble();
    final double y2 = in.readDouble();
    return new Line2D.Double(x1, y1, x2, y2);
   * Returns the class of the object, which this object can serialize. 
   * @return the class of java.awt.geom.Line2D. 
  public Class getObjectClass ()
    return Line2D.class;