GlueGen: com.jogamp.common.net.AssetURLConnection Class Reference

GlueGen v2.6.0 GlueGen, Native Binding Generator for Java™ (public API).

Public Member Functions | List of all members
com.jogamp.common.net.AssetURLConnection Class Reference

See base class `PiggybackURLConnection` for motivation. More...

Inheritance diagram for com.jogamp.common.net.AssetURLConnection:
Collaboration diagram for com.jogamp.common.net.AssetURLConnection:

## Public Member Functions

| AssetURLConnection (final URL url, final AssetURLContext implHelper)
String | getEntryName () throws IOException
Public Member Functions inherited from com.jogamp.common.net.PiggybackURLConnection< AssetURLContext >
synchronized void | connect () throws IOException
InputStream | getInputStream () throws IOException
abstract String | getEntryName () throws IOException
| Returns the entry name of the asset. More...
URL | getSubProtocol () throws IOException
| Returns the resolved sub protocol of the asset or null, ie: More...

## Additional Inherited Members

Protected Member Functions inherited from com.jogamp.common.net.PiggybackURLConnection< AssetURLContext >
| PiggybackURLConnection (final URL url, final I context)
Protected Attributes inherited from com.jogamp.common.net.PiggybackURLConnection< AssetURLContext >
URL | subUrl
URLConnection | subConn
I | context

## Detailed Description

See base class `PiggybackURLConnection` for motivation.

asset resource location protocol connection.

See `AssetURLContext#resolve(String)` how resources are being resolved.

### Example:

Assuming the plain asset entry `test/lala.txt` is being resolved by a class `test.LaLaTest`, ie. using the asset aware ClassLoader, one would use the following asset aware filesystem layout:

     test/LaLaTest.class
     assets/test/lala.txt

The above maybe on a plain filesystem, or within a JAR or an APK file, e.g. `jogamp.test.apk`.

The above would result in the following possible URLs reflecting the plain and resolved state of the asset URL:

     0 Entry          test/lala.txt
     1 Plain    asset:test/lala.txt
     2 Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt

The sub protocol URL of the resolved asset

     3 Sub-URL        jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt

can be retrieved using `getSubProtocol()`.

In all above cases, the asset entry is `test/lala.txt`, which can be retrieved via `getEntryName()`.

### General Implementation Notes:

An asset URL is resolved using `AssetURLContext#getClassLoader()`.`getResource(String)`, hence the only requirement for an implementation is to have an asset aware ClassLoader as described in `AssetURLContext#getClassLoader()`.

### Warning:

Since the asset protocol is currently not being implemented on all platform with an appropriate ClassLoader, a user shall not create the asset URL manually.

### Android Implementation Notes:

The Android ClassLoader `jogamp.android.launcher.AssetDexClassLoader` resolves the resource as an asset URL in it's `ClassLoader#findResource(String)` implementation.

Currently we attach our asset `java.net.URLStreamHandlerFactory` to allow `java.net.URL` to handle asset URLs via our asset `java.net.URLStreamHandler` implementation.

Definition at line 72 of file AssetURLConnection.java.

## Constructor & Destructor Documentation

## ◆ AssetURLConnection()

com.jogamp.common.net.AssetURLConnection.AssetURLConnection | ( | final URL | url,
|  | final AssetURLContext | implHelper
| ) |  |

Definition at line 74 of file AssetURLConnection.java.

## Member Function Documentation

## ◆ getEntryName()

String com.jogamp.common.net.AssetURLConnection.getEntryName | ( |  | ) | throws IOException

Definition at line 79 of file AssetURLConnection.java.

Here is the caller graph for this function:

The documentation for this class was generated from the following file:

- src/java/com/jogamp/common/net/AssetURLConnection.java