1. /*
  2. * @(#)ContentHandler.java 1.11 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.net;
  8. import java.io.IOException;
  9. /**
  10. * The abstract class <code>ContentHandler</code> is the superclass
  11. * of all classes that read an <code>Object</code> from a
  12. * <code>URLConnection</code>.
  13. * <p>
  14. * An application does not generally call the
  15. * <code>getContent</code> method in this class directly. Instead, an
  16. * application calls the <code>getContent</code> method in class
  17. * <code>URL</code> or in <code>URLConnection</code>.
  18. * The application's content handler factory (an instance of a class that
  19. * implements the interface <code>ContentHandlerFactory</code> set
  20. * up by a call to <code>setContentHandler</code>) is
  21. * called with a <code>String</code> giving the MIME type of the
  22. * object being received on the socket. The factory returns an
  23. * instance of a subclass of <code>ContentHandler</code>, and its
  24. * <code>getContent</code> method is called to create the object.
  25. *
  26. * @author James Gosling
  27. * @version 1.11, 11/29/01
  28. * @see java.net.ContentHandler#getContent(java.net.URLConnection)
  29. * @see java.net.ContentHandlerFactory
  30. * @see java.net.URL#getContent()
  31. * @see java.net.URLConnection
  32. * @see java.net.URLConnection#getContent()
  33. * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory)
  34. * @since JDK1.0
  35. */
  36. abstract public class ContentHandler {
  37. /**
  38. * Given a URL connect stream positioned at the beginning of the
  39. * representation of an object, this method reads that stream and
  40. * creates an object from it.
  41. *
  42. * @param urlc a URL connection.
  43. * @return the object read by the <code>ContentHandler</code>.
  44. * @exception IOException if an I/O error occurs while reading the object.
  45. */
  46. abstract public Object getContent(URLConnection urlc) throws IOException;
  47. }