Class InternalResource
- java.lang.Object
-
- com.github.bordertech.wcomponents.InternalResource
-
- All Implemented Interfaces:
ContentAccess,ContentStreamAccess,Serializable
- Direct Known Subclasses:
AudioResource,ImageResource,VideoResource
public class InternalResource extends Object implements ContentStreamAccess
Provides a bridge to static resources which are present in the class path, but not in the web application itself.- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InternalResource(String resourceName, String description)Creates an InternalResource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getBytes()The bytes that make up the document content.StringgetDescription()Some text that describes the document content.StringgetMimeType()The mime type of the document.StringgetResourceName()InputStreamgetStream()Retrieves the stream that make up the document content.StringgetTargetUrl()StringtoString()
-
-
-
Method Detail
-
getBytes
public byte[] getBytes()
Description copied from interface:ContentAccessThe bytes that make up the document content.- Specified by:
getBytesin interfaceContentAccess- Returns:
- the data from the resource, or an empty byte array.
-
getStream
public InputStream getStream() throws IOException
Retrieves the stream that make up the document content.- Specified by:
getStreamin interfaceContentStreamAccess- Returns:
- the stream containing the document content.
- Throws:
IOException- if there is an error retrieving the content.
-
getDescription
public String getDescription()
Some text that describes the document content. This text could be the document filename or title, for instance.- Specified by:
getDescriptionin interfaceContentAccess- Returns:
- a short document description
-
getMimeType
public String getMimeType()
The mime type of the document. For example, "image/jpeg", "image/gif", "application/pdf" etc- Specified by:
getMimeTypein interfaceContentAccess- Returns:
- the mime type.
-
getResourceName
public String getResourceName()
- Returns:
- the name (path) of the resource.
-
getTargetUrl
public String getTargetUrl()
- Returns:
- the URL which can be used to target this resource.
-
-