Package com.jogamp.common.net
Class PiggybackURLConnection<I extends PiggybackURLContext>
- java.lang.Object
-
- java.net.URLConnection
-
- com.jogamp.common.net.PiggybackURLConnection<I>
-
- Direct Known Subclasses:
AssetURLConnection
public abstract class PiggybackURLConnection<I extends PiggybackURLContext> extends URLConnection
Generic resource location protocol connection, using another sub-protocol as the vehicle for a piggyback protocol.The details of the sub-protocol can be queried using
getSubProtocol()
.See example in
AssetURLConnection
.
-
-
Field Summary
Fields Modifier and Type Field Description protected I
context
protected URLConnection
subConn
protected URL
subUrl
-
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PiggybackURLConnection(URL url, I context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
connect()
Resolves the URL viaPiggybackURLContext.resolve(String)
, seeAssetURLContext.resolve(String)
for an example.abstract String
getEntryName()
Returns the entry name of the asset.InputStream
getInputStream()
URL
getSubProtocol()
Returns the resolved sub protocol of the asset or null, ie:-
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
-
-
Field Detail
-
subUrl
protected URL subUrl
-
subConn
protected URLConnection subConn
-
context
protected I extends PiggybackURLContext context
-
-
Method Detail
-
connect
public void connect() throws IOException
Resolves the URL via
PiggybackURLContext.resolve(String)
, seeAssetURLContext.resolve(String)
for an example.- Specified by:
connect
in classURLConnection
- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
- Overrides:
getInputStream
in classURLConnection
- Throws:
IOException
-
getEntryName
public abstract String getEntryName() throws IOException
Returns the entry name of the asset.Plain asset:test/lala.txt Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt Result test/lala.txt
- Throws:
IOException
- is not connected
-
getSubProtocol
public URL getSubProtocol() throws IOException
Returns the resolved sub protocol of the asset or null, ie:Plain asset:test/lala.txt Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt Result jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
- Throws:
IOException
- is not connected
-
-