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.String
getDescription()
Some text that describes the document content.String
getMimeType()
The mime type of the document.String
getResourceName()
InputStream
getStream()
Retrieves the stream that make up the document content.String
getTargetUrl()
String
toString()
-
-
-
Method Detail
-
getBytes
public byte[] getBytes()
Description copied from interface:ContentAccess
The bytes that make up the document content.- Specified by:
getBytes
in 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:
getStream
in 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:
getDescription
in 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:
getMimeType
in 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.
-
-