public abstract class AbstractResource extends Object implements Resource
AbstractResourceOrigin
. Subclasses merely need to expose a constructor
for the ResourceOrigin
to use, and a method to let it retrieve the underlying resource object.AbstractResourceOrigin
Modifier | Constructor and Description |
---|---|
protected |
AbstractResource(AbstractResourceOrigin origin) |
Modifier and Type | Method and Description |
---|---|
long |
getLastModified()
Returns the last modification date of this resource as the number of milliseconds since January 1, 1970, 00:00:00 GMT.
|
String |
getName() |
ResourceOrigin |
getOrigin() |
Resource |
getParent() |
String |
getPath()
Returns the "absolute" path to this resource.
|
boolean |
isDirectory() |
boolean |
isEditable()
Determines whether this resource can be edited in its underlying origin.
|
boolean |
isFile() |
List<Resource> |
listChildren() |
Reader |
openReader()
Opens a
Reader for this resource; if the associated ResourceOrigin can guess it, this will have been
opened with the corrected encoding. |
InputStream |
openStream()
Opens an
InputStream for this resource. |
String |
toString() |
protected AbstractResource(AbstractResourceOrigin origin)
public ResourceOrigin getOrigin()
public boolean isDirectory()
isDirectory
in interface Resource
public boolean isEditable()
Resource
isEditable
in interface Resource
public String getPath()
Resource
public long getLastModified()
Resource
getLastModified
in interface Resource
Date.getTime()
public List<Resource> listChildren()
listChildren
in interface Resource
public InputStream openStream() throws IOException
Resource
InputStream
for this resource. Client code is expected to close the stream.openStream
in interface Resource
IOException
Resource.openReader()
public Reader openReader() throws IOException
Resource
Reader
for this resource; if the associated ResourceOrigin
can guess it, this will have been
opened with the corrected encoding. Client code is expected to close the reader.openReader
in interface Resource
IOException
Resource.openStream()
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.