public class NestableURLConnection extends URLConnection
getOutputStream() will
invariably return nullgetInputStream() method
will be used internally, so this class may be used even for not nested URLsZipStreamHandlerFactory, because by default Java does not accept to handle nested jar protocols (and the jar
protocol is used even for zip files).| Modifier and Type | Field and Description |
|---|---|
protected boolean |
firstEntry |
protected String |
urlPath |
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches| Constructor and Description |
|---|
NestableURLConnection()
Constructs a new connection.
|
NestableURLConnection(URL url)
Constructs a new connection for the URL.
|
NestableURLConnection(URL url,
boolean firstEntry)
Constructs a new connection for the URL.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Advertise that this connection is connected.
|
InputStream |
getInputStream()
Creates the input stream for the URL.
|
OutputStream |
getOutputStream()
Return null.
|
boolean |
isAcceptingAlternateProtocols()
Return true if the connection accept alternate protocols, in addition to zip.
|
void |
setAcceptAlternateProtocols(boolean acceptAltProtocols)
Set if the connection accept alternate protocols, in addition to zip.
|
void |
setURL(URL url)
Set the connection URL.
|
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toStringprotected String urlPath
protected boolean firstEntry
public NestableURLConnection(URL url)
url - the URL of this connection.public NestableURLConnection()
public NestableURLConnection(URL url, boolean firstEntry)
url - the URL of this connection.firstEntry - true for the first entrypublic void setAcceptAlternateProtocols(boolean acceptAltProtocols)
acceptAltProtocols - true if the connection accept alternate protocolspublic boolean isAcceptingAlternateProtocols()
public void setURL(URL url)
url - the urlpublic void connect()
throws IOException
URLConnection.connected field will be set to true.connect in class URLConnectionIOException - if an I/O error occurs while opening the connectionpublic InputStream getInputStream() throws IOException
getInputStream() method will be used internally, so this method may be used even for not nested URLs.getInputStream in class URLConnectionIOException - if an I/O error occurs while creating the input streampublic OutputStream getOutputStream() throws IOException
getOutputStream in class URLConnectionIOException