com.calitha.resource
Class WWWResource

java.lang.Object
  extended by com.calitha.resource.Resource
      extended by com.calitha.resource.BinaryResource
          extended by com.calitha.resource.WWWResource
All Implemented Interfaces:
IResource

public final class WWWResource
extends BinaryResource

A WWWResource object represents a resource on the World Wide Web.

The location of the resource is specified by an URL. All protocols can be used that are supported by the URL class. You can also use the file: protocol to load local files.

When using a relative URL it will use the startup directory as the context.

Author:
Robert van Loenhout

Constructor Summary
WWWResource(Locale locale, String namespace, String id, String mimetype, URL url)
          Creates a new WWWResource object.
 
Method Summary
 byte[] getBytes()
          Gets the content of the resource as a byte array.
 URL getUrl()
          Gets the URL from which this resource is loaded.
 
Methods inherited from class com.calitha.resource.BinaryResource
getText, getText
 
Methods inherited from class com.calitha.resource.Resource
createKey, equals, getId, getKey, getLocale, getMimetype, getNamespace, hashCode, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WWWResource

public WWWResource(Locale locale,
                   String namespace,
                   String id,
                   String mimetype,
                   URL url)
Creates a new WWWResource object. The resource is loaded when the contents of the resource are requested. The contents are cached if the cache parameter is true.

Parameters:
locale - locale
namespace - namespace
id - id
mimetype - mimetype
url - url
Method Detail

getUrl

public URL getUrl()
Gets the URL from which this resource is loaded.

Returns:
URL

getBytes

public byte[] getBytes()
Description copied from interface: IResource
Gets the content of the resource as a byte array.

Returns:
bytes