|
Forge - Resource Addon API 2.0.0.Alpha3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.forge.facets.AbstractFaceted<ResourceFacet>
org.jboss.forge.resource.AbstractResource<File>
org.jboss.forge.resource.AbstractFileResource<T>
public abstract class AbstractFileResource<T extends FileResource<T>>
A standard, built-in resource for representing files on the filesystem.
| Field Summary | |
|---|---|
protected File |
file
|
protected long |
lastModification
|
| Fields inherited from class org.jboss.forge.resource.AbstractResource |
|---|
parent, resourceFactory |
| Constructor Summary | |
|---|---|
protected |
AbstractFileResource(ResourceFactory factory,
File file)
|
| Method Summary | ||
|---|---|---|
abstract Resource<File> |
createFrom(File file)
Create a new Resource instance for the target file. |
|
boolean |
createNewFile()
Create the file in the underlying resource system. |
|
T |
createTempResource()
Create a temporary FileResource |
|
boolean |
delete()
Delete this file, non-recursively. |
|
boolean |
delete(boolean recursive)
Delete this Resource, and all child resources. |
|
void |
deleteOnExit()
Requests that the file or directory denoted by this resource be deleted when the virtual machine terminates. |
|
boolean |
exists()
Return true if this Resource exists, return false if not. |
|
Resource<?> |
getChild(String name)
Get a child of this resource. |
|
String |
getName()
Return the common name of the resource. |
|
Resource<?> |
getParent()
Get the parent of the current resource. |
|
InputStream |
getResourceInputStream()
Get the InputStream represented by this Resource. |
|
long |
getSize()
Returns the size of the file denoted by this abstract pathname |
|
File |
getUnderlyingResourceObject()
Get the actual underlying file resource that this resource instance represents, whether existing or non-existing. |
|
boolean |
isDirectory()
Return true if this AbstractFileResource exists and is actually a directory, otherwise return false; |
|
boolean |
isExecutable()
Returns if a file is executable |
|
boolean |
isReadable()
Returns if a file is readable |
|
boolean |
isStale()
Returns true if the underlying resource has been modified on the file system since it was initially loaded. |
|
boolean |
isWritable()
Returns if a file is writable |
|
void |
markUpToDate()
Re-read the last modified timestamp for this resource. |
|
boolean |
mkdir()
Create a new single directory for this resource. |
|
boolean |
mkdirs()
Create all directories required for this resource to exist. |
|
|
reify(Class<R> type)
Ask this Resource if it is actually a resource of the given type; if it is, return a new reference to the
resource as the given type, otherwise return null. |
|
boolean |
renameTo(FileResource<?> target)
Rename this resource to the given AbstractFileResource |
|
boolean |
renameTo(String pathspec)
Rename this resource to the given path. |
|
T |
setContents(char[] data)
Set the contents of this AbstractFileResource to the given character array. |
|
T |
setContents(InputStream data)
Set the contents of this FileResource to the contents of the given InputStream. |
|
T |
setContents(String data)
Set the contents of this AbstractFileResource to the given String |
|
String |
toString()
|
|
| Methods inherited from class org.jboss.forge.resource.AbstractResource |
|---|
doListResources, equals, getFullyQualifiedName, getResourceFactory, hashCode, listResources, listResources, supports |
| Methods inherited from class org.jboss.forge.facets.AbstractFaceted |
|---|
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, uninstall |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jboss.forge.resource.Resource |
|---|
getFullyQualifiedName, getResourceFactory, listResources, listResources |
| Methods inherited from interface org.jboss.forge.facets.Faceted |
|---|
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, supports, uninstall |
| Field Detail |
|---|
protected File file
protected long lastModification
| Constructor Detail |
|---|
protected AbstractFileResource(ResourceFactory factory,
File file)
| Method Detail |
|---|
public String getName()
Resource
getName in interface Resource<File>public String toString()
toString in class Objectpublic File getUnderlyingResourceObject()
getUnderlyingResourceObject in interface Resource<File>Filepublic InputStream getResourceInputStream()
ResourceInputStream represented by this Resource.
getResourceInputStream in interface Resource<File>public Resource<?> getParent()
getParent in interface Resource<File>getParent in class AbstractResource<File>public Resource<?> getChild(String name)
Resource
getChild in interface Resource<File>public abstract Resource<File> createFrom(File file)
Resource instance for the target file. The new Resource should be of the same type as
this.
createFrom in interface Resource<File>file - The file to create the resource instance from.
public boolean exists()
ResourceResource exists, return false if not.
exists in interface Resource<File>public boolean isDirectory()
AbstractFileResource exists and is actually a directory, otherwise return false;
isDirectory in interface FileResource<T extends FileResource<T>>public boolean isStale()
isStale in interface FileResource<T extends FileResource<T>>public void markUpToDate()
markUpToDate in interface FileResource<T extends FileResource<T>>public boolean mkdir()
mkdirs()
mkdir in interface FileResource<T extends FileResource<T>>public boolean mkdirs()
mkdirs in interface FileResource<T extends FileResource<T>>public boolean delete()
delete in interface Resource<File>public boolean delete(boolean recursive)
Resource, and all child resources.
delete in interface Resource<File>recursive - if false and this resource both supports recursive deletion and contains children, deletion will
not occur; otherwise, if true, deletion will propagate to all child resources. Implementations may
choose simply to delegate to Resource.delete()public void deleteOnExit()
Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care.
deleteOnExit in interface FileResource<T extends FileResource<T>>public T setContents(String data)
AbstractFileResource to the given String
setContents in interface FileResource<T extends FileResource<T>>public T setContents(char[] data)
AbstractFileResource to the given character array.
setContents in interface FileResource<T extends FileResource<T>>public T setContents(InputStream data)
FileResourceFileResource to the contents of the given InputStream.
setContents in interface FileResource<T extends FileResource<T>>public boolean createNewFile()
createNewFile in interface FileResource<T extends FileResource<T>>public T createTempResource()
FileResourceFileResource
createTempResource in interface FileResource<T extends FileResource<T>>public <R extends Resource<?>> R reify(Class<R> type)
ResourceResource if it is actually a resource of the given type; if it is, return a new reference to the
resource as the given type, otherwise return null.
reify in interface Resource<File>reify in class AbstractResource<File>public boolean renameTo(String pathspec)
renameTo in interface FileResource<T extends FileResource<T>>public boolean renameTo(FileResource<?> target)
AbstractFileResource
renameTo in interface FileResource<T extends FileResource<T>>public long getSize()
FileResource
getSize in interface FileResource<T extends FileResource<T>>public boolean isExecutable()
FileResource
isExecutable in interface FileResource<T extends FileResource<T>>public boolean isReadable()
FileResource
isReadable in interface FileResource<T extends FileResource<T>>public boolean isWritable()
FileResource
isWritable in interface FileResource<T extends FileResource<T>>
|
Forge - Resource Addon API 2.0.0.Alpha3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||