67 * If no user-defined content handler is found, then the system 68 * tries to load a specific <i>content-type</i> handler from one 69 * of the built-in handlers, if one exists. 70 * <p> 71 * If the loading of the content handler class would be performed by 72 * a classloader that is outside of the delegation chain of the caller, 73 * the JVM will need the RuntimePermission "getClassLoader". 74 * 75 * @author James Gosling 76 * @see java.net.ContentHandler#getContent(java.net.URLConnection) 77 * @see java.net.ContentHandlerFactory 78 * @see java.net.URL#getContent() 79 * @see java.net.URLConnection 80 * @see java.net.URLConnection#getContent() 81 * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory) 82 * @since 1.0 83 */ 84 public abstract class ContentHandler { 85 86 /** 87 * Given a URL connect stream positioned at the beginning of the 88 * representation of an object, this method reads that stream and 89 * creates an object from it. 90 * 91 * @param urlc a URL connection. 92 * @return the object read by the {@code ContentHandler}. 93 * @throws IOException if an I/O error occurs while reading the object. 94 */ 95 public abstract Object getContent(URLConnection urlc) throws IOException; 96 97 /** 98 * Given a URL connect stream positioned at the beginning of the 99 * representation of an object, this method reads that stream and 100 * creates an object that matches one of the types specified. 101 * 102 * The default implementation of this method should call 103 * {@link #getContent(URLConnection)} 104 * and screen the return type for a match of the suggested types. 105 * 106 * @param urlc a URL connection. | 67 * If no user-defined content handler is found, then the system 68 * tries to load a specific <i>content-type</i> handler from one 69 * of the built-in handlers, if one exists. 70 * <p> 71 * If the loading of the content handler class would be performed by 72 * a classloader that is outside of the delegation chain of the caller, 73 * the JVM will need the RuntimePermission "getClassLoader". 74 * 75 * @author James Gosling 76 * @see java.net.ContentHandler#getContent(java.net.URLConnection) 77 * @see java.net.ContentHandlerFactory 78 * @see java.net.URL#getContent() 79 * @see java.net.URLConnection 80 * @see java.net.URLConnection#getContent() 81 * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory) 82 * @since 1.0 83 */ 84 public abstract class ContentHandler { 85 86 /** 87 * Constructor for subclasses to call. 88 */ 89 public ContentHandler() {} 90 91 /** 92 * Given a URL connect stream positioned at the beginning of the 93 * representation of an object, this method reads that stream and 94 * creates an object from it. 95 * 96 * @param urlc a URL connection. 97 * @return the object read by the {@code ContentHandler}. 98 * @throws IOException if an I/O error occurs while reading the object. 99 */ 100 public abstract Object getContent(URLConnection urlc) throws IOException; 101 102 /** 103 * Given a URL connect stream positioned at the beginning of the 104 * representation of an object, this method reads that stream and 105 * creates an object that matches one of the types specified. 106 * 107 * The default implementation of this method should call 108 * {@link #getContent(URLConnection)} 109 * and screen the return type for a match of the suggested types. 110 * 111 * @param urlc a URL connection. |