Interface Resource
-
public interface Resource
AResource
represents any content that can be served through theResourceHandler
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getLastModified()
Returns the timestamp when the resource has been last modified (expressed inTimeUnit.MILLISECONDS
).String
getType()
Returns the media type of this resource.boolean
hasChangedSince(long sinceTime)
Returnstrue
if the resource has changed since the given timestamp (expressed in ms).InputStream
open()
Returns a newInputStream
used to read resource's content.
-
-
-
Method Detail
-
open
InputStream open() throws IOException
Returns a newInputStream
used to read resource's content. Note that this is the responsibility of the caller to close the stream.- Returns:
- a new
InputStream
- Throws:
IOException
- if the stream cannot be opened
-
getType
String getType()
Returns the media type of this resource.- Returns:
- the media type of this resource.
-
getLastModified
long getLastModified()
Returns the timestamp when the resource has been last modified (expressed inTimeUnit.MILLISECONDS
).- Returns:
- the timestamp when the resource has been last modified (ms)
-
hasChangedSince
boolean hasChangedSince(long sinceTime)
Returnstrue
if the resource has changed since the given timestamp (expressed in ms).- Parameters:
sinceTime
- timestamp to compare with this resource's last modified timestamp.- Returns:
true
if the resource has changed since the given timestamp (expressed in ms).
-
-