/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
return getContentHandler(contentType).getContent(this, types);
/** * Retrieves the contents of this URL connection. * * @param classes the <code>Class</code> array * indicating the requested types * @return the object fetched that is the first match of the type * specified in the classes array. null if none of * the requested types are supported. * The <code>instanceof</code> operator should be used to * determine the specific kind of object returned. * @exception IOException if an I/O error occurs while * getting the content. * @exception UnknownServiceException if the protocol does not support * the content type. * @see java.net.URLConnection#getContent() * @see java.net.ContentHandlerFactory#createContentHandler(java.lang.String) * @see java.net.URLConnection#getContent(java.lang.Class[]) * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory) * @since 1.3 */ public Object getContent(Class[] classes) throws IOException { // Must call getInputStream before GetHeaderField gets called // so that FileNotFoundException has a chance to be thrown up // from here without being caught. getInputStream(); return getContentHandler().getContent(this, classes); }
/** * Retrieves the contents of this URL connection. * * @param classes the <code>Class</code> array * indicating the requested types * @return the object fetched that is the first match of the type * specified in the classes array. null if none of * the requested types are supported. * The <code>instanceof</code> operator should be used to * determine the specific kind of object returned. * @exception IOException if an I/O error occurs while * getting the content. * @exception UnknownServiceException if the protocol does not support * the content type. * @see java.net.URLConnection#getContent() * @see java.net.ContentHandlerFactory#createContentHandler(java.lang.String) * @see java.net.URLConnection#getContent(java.lang.Class[]) * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory) * @since 1.3 */ public Object getContent(Class[] classes) throws IOException { // Must call getInputStream before GetHeaderField gets called // so that FileNotFoundException has a chance to be thrown up // from here without being caught. getInputStream(); return getContentHandler().getContent(this, classes); }
return getContentHandler().getContent(this);
return getContentHandler().getContent(this);
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. The content type must match with one of * the list {@code types}. * * @param types the list of acceptable content types. * @return the content representing object or {@code null} if the content * type does not match with one of the specified types. * @throws IOException if an error occurs obtaining the content. */ // Param is not generic in spec @SuppressWarnings("unchecked") public Object getContent(Class[] types) throws IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this, types); } return null; }
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
return getContentHandler(contentType).getContent(this, types);
/** * Returns an object representing the content of the resource this {@code * URLConnection} is connected to. First, it attempts to get the content * type from the method {@code getContentType()} which looks at the response * header field "Content-Type". If none is found it will guess the content * type from the filename extension. If that fails the stream itself will be * used to guess the content type. * * @return the content representing object. * @throws IOException * if an error occurs obtaining the content. */ public Object getContent() throws java.io.IOException { if (!connected) { connect(); } if ((contentType = getContentType()) == null) { if ((contentType = guessContentTypeFromName(url.getFile())) == null) { contentType = guessContentTypeFromStream(getInputStream()); } } if (contentType != null) { return getContentHandler(contentType).getContent(this); } return null; }
return getContentHandler(contentType).getContent(this, types);
return getContentHandler(contentType).getContent(this, types);
return getContentHandler(contentType).getContent(this, types);
return getContentHandler(contentType).getContent(this, types);
return getContentHandler(contentType).getContent(this, types);