GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.common.net.AssetURLContext Class Referenceabstract

See PiggybackURLConnection for description and examples. More...

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

Public Member Functions

abstract ClassLoader getClassLoader ()
 Returns an asset aware ClassLoader. More...
 
String getImplementedProtocol ()
 Returns the specific protocol, constant for this implementation. More...
 
URLConnection resolve (final String path) throws IOException
 Resolving path to a URL sub protocol and return it's open URLConnection. More...
 
String getImplementedProtocol ()
 Returns the specific protocol, constant for this implementation. More...
 
URLConnection resolve (String path) throws IOException
 Resolving path to a URL sub protocol and return it's open URLConnection. More...
 

Static Public Member Functions

static AssetURLContext create (final ClassLoader cl)
 
static AssetURLStreamHandler createHandler (final ClassLoader cl)
 
static URL createURL (final String path, final ClassLoader cl) throws MalformedURLException
 Create an asset URL, suitable even w/o the registered asset URLStreamHandler. More...
 
static URL createURL (final String path) throws MalformedURLException
 Create an asset URL, suitable only with the registered asset URLStreamHandler. More...
 
static URLStreamHandler getRegisteredHandler ()
 Returns the asset handler previously set via registerHandler(ClassLoader), or null if none was set. More...
 
static boolean registerHandler (final ClassLoader cl)
 Registers the generic URLStreamHandlerFactory via GenericURLStreamHandlerFactory#register() and if successful sets the asset handler for the given ClassLoader cl. More...
 
static URLConnection resolve (String path, final ClassLoader cl) throws IOException
 

Static Public Attributes

static final String asset_protocol = "asset"
 The asset URL protocol name asset More...
 
static final String asset_protocol_prefix = "asset:"
 The asset URL protocol prefix asset: More...
 
static final String assets_folder = "assets/"
 The optional asset folder name with ending slash assets/. More...
 

Detailed Description

See PiggybackURLConnection for description and examples.

Definition at line 18 of file AssetURLContext.java.

Member Function Documentation

◆ create()

static AssetURLContext com.jogamp.common.net.AssetURLContext.create ( final ClassLoader  cl)
static

Definition at line 36 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createHandler()

static AssetURLStreamHandler com.jogamp.common.net.AssetURLContext.createHandler ( final ClassLoader  cl)
static

Definition at line 45 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createURL() [1/2]

static URL com.jogamp.common.net.AssetURLContext.createURL ( final String  path) throws MalformedURLException
static

Create an asset URL, suitable only with the registered asset URLStreamHandler.

This is equivalent with:

  return new URL(path.startsWith("asset:") ? path : "asset:" + path);
Parameters
pathresource path, with or w/o asset: prefix
Returns
Exceptions
MalformedURLException

Definition at line 78 of file AssetURLContext.java.

◆ createURL() [2/2]

static URL com.jogamp.common.net.AssetURLContext.createURL ( final String  path,
final ClassLoader  cl 
) throws MalformedURLException
static

Create an asset URL, suitable even w/o the registered asset URLStreamHandler.

This is equivalent with:

  return new URL(null, path.startsWith("asset:") ? path : "asset:" + path, new AssetURLStreamHandler(cl));
Parameters
pathresource path, with or w/o asset: prefix
clthe ClassLoader used to resolve the location, see getClassLoader().
Returns
Exceptions
MalformedURLException

Definition at line 62 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getClassLoader()

abstract ClassLoader com.jogamp.common.net.AssetURLContext.getClassLoader ( )
abstract

Returns an asset aware ClassLoader.

The ClassLoader is required to find the asset resource via it's URL findResource(String) implementation.

It's URL findResource(String) implementation shall return either an asset URL asset:sub-protocol or just the sub-protocol URL.

For example, on Android, we redirect all path request to assets/path.

Here is the caller graph for this function:

◆ getImplementedProtocol()

String com.jogamp.common.net.AssetURLContext.getImplementedProtocol ( )

Returns the specific protocol, constant for this implementation.

Implements com.jogamp.common.net.PiggybackURLContext.

Definition at line 124 of file AssetURLContext.java.

◆ getRegisteredHandler()

static URLStreamHandler com.jogamp.common.net.AssetURLContext.getRegisteredHandler ( )
static

Returns the asset handler previously set via registerHandler(ClassLoader), or null if none was set.

Definition at line 86 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerHandler()

static boolean com.jogamp.common.net.AssetURLContext.registerHandler ( final ClassLoader  cl)
static

Registers the generic URLStreamHandlerFactory via GenericURLStreamHandlerFactory#register() and if successful sets the asset handler for the given ClassLoader cl.

Returns
true if successful, otherwise false

Definition at line 97 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolve() [1/2]

URLConnection com.jogamp.common.net.AssetURLContext.resolve ( final String  path) throws IOException

Resolving path to a URL sub protocol and return it's open URLConnection.

This implementation attempts to resolve path in the following order:

  1. as a valid URL: new URL(path), use sub-protocol if asset URL
  2. via ClassLoader: getClassLoader().getResource(path), use sub-protocol if asset URL
  3. as a File: new File(path).toURI().toURL()

In case of using the ClassLoader (2) and if running on Android, the assets_folder is being prepended to path if missing.

Implements com.jogamp.common.net.PiggybackURLContext.

Definition at line 144 of file AssetURLContext.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolve() [2/2]

static URLConnection com.jogamp.common.net.AssetURLContext.resolve ( String  path,
final ClassLoader  cl 
) throws IOException
static

Definition at line 148 of file AssetURLContext.java.

Here is the call graph for this function:

Member Data Documentation

◆ asset_protocol

final String com.jogamp.common.net.AssetURLContext.asset_protocol = "asset"
static

The asset URL protocol name asset

Definition at line 22 of file AssetURLContext.java.

◆ asset_protocol_prefix

final String com.jogamp.common.net.AssetURLContext.asset_protocol_prefix = "asset:"
static

The asset URL protocol prefix asset:

Definition at line 25 of file AssetURLContext.java.

◆ assets_folder

final String com.jogamp.common.net.AssetURLContext.assets_folder = "assets/"
static

The optional asset folder name with ending slash assets/.

Note that the asset folder is not used on all platforms using the asset protocol and you should not rely on it, use AssetURLConnection#getEntryName().

Definition at line 34 of file AssetURLContext.java.


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