Package com.ardor3d.util.resource
Class URLResourceSource
java.lang.Object
com.ardor3d.util.resource.URLResourceSource
- All Implemented Interfaces:
Savable
,ResourceSource
-
Field Summary
Fields inherited from interface com.ardor3d.util.resource.ResourceSource
UNKNOWN_TYPE
-
Constructor Summary
ConstructorDescriptionConstruct a new URLResourceSource.URLResourceSource
(URL sourceUrl) Construct a new URLResourceSource from a specific URL.URLResourceSource
(URL sourceUrl, String type) Construct a new URLResourceSource from a specific URL and type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Class
<?> getName()
getRelativeSource
(String name) Generate and return a new ResourceSource pointing to a named resource that is relative to this object's resource.getType()
getURL()
int
hashCode()
void
read
(InputCapsule capsule) void
void
toString()
void
write
(OutputCapsule capsule)
-
Constructor Details
-
URLResourceSource
public URLResourceSource()Construct a new URLResourceSource. Must set URL separately. -
URLResourceSource
Construct a new URLResourceSource from a specific URL.- Parameters:
sourceUrl
- The url to load the resource from. Must not be null. If the URL has a valid URL filename (seeURL.getFile()
) and an extension (eg. http://url/myFile.png) then the extension (.png in this case) is used as the type.
-
URLResourceSource
Construct a new URLResourceSource from a specific URL and type.- Parameters:
sourceUrl
- The url to load the resource from. Must not be null.type
- our type. Usually a file extension such as .png. Required for generic loading when multiple resource handlers could be used.
-
-
Method Details
-
getRelativeSource
Description copied from interface:ResourceSource
Generate and return a new ResourceSource pointing to a named resource that is relative to this object's resource.- Specified by:
getRelativeSource
in interfaceResourceSource
- Parameters:
name
- the name of the resource we want. eg. "./mypic.jpg" etc.- Returns:
- the relative resource, or null if none is found. Will also return null if this ResourceSource type does not support relative source.
-
setURL
-
getURL
-
getName
- Specified by:
getName
in interfaceResourceSource
- Returns:
- the name of this resource.
-
getType
- Specified by:
getType
in interfaceResourceSource
- Returns:
- the "type" of resource we are pointing to. For example ".jpg", ".dae", etc.
-
setType
-
openStream
- Specified by:
openStream
in interfaceResourceSource
- Returns:
- an InputStream to this resource's contents.
- Throws:
IOException
- if something wrong occurs while reading
-
toString
-
hashCode
public int hashCode() -
equals
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-