Forge - Resource Addon API 2.0.0.Alpha3

org.jboss.forge.resource
Interface FileResource<T extends FileResource<T>>

All Superinterfaces:
org.jboss.forge.facets.Faceted<ResourceFacet>, Resource<File>
All Known Subinterfaces:
DirectoryResource
All Known Implementing Classes:
AbstractFileResource

public interface FileResource<T extends FileResource<T>>
extends Resource<File>

A standard, built-in resource for representing files on the filesystem.

Author:
Mike Brock, Lincoln Baxter, III

Method Summary
 boolean createNewFile()
          Create the file in the underlying resource system.
 T createTempResource()
          Create a temporary FileResource
 void deleteOnExit()
          Requests that the file or directory denoted by this resource be deleted when the virtual machine terminates.
 long getSize()
          Returns the size of the file denoted by this abstract pathname
 boolean isDirectory()
          Return true if this FileResource 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.
 boolean renameTo(FileResource<?> target)
          Rename this Resource to the given FileResource
 boolean renameTo(String pathspec)
          Rename this Resource to the given path.
 T setContents(char[] data)
          Set the contents of this FileResource 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 FileResource to the given String
 
Methods inherited from interface org.jboss.forge.resource.Resource
createFrom, delete, delete, exists, getChild, getFullyQualifiedName, getName, getParent, getResourceFactory, getResourceInputStream, getUnderlyingResourceObject, listResources, listResources, reify
 
Methods inherited from interface org.jboss.forge.facets.Faceted
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, supports, uninstall
 

Method Detail

isDirectory

boolean isDirectory()
Return true if this FileResource exists and is actually a directory, otherwise return false;


isStale

boolean isStale()
Returns true if the underlying resource has been modified on the file system since it was initially loaded.

Returns:
boolean true if resource is changed.

markUpToDate

void markUpToDate()
Re-read the last modified timestamp for this resource.


mkdir

boolean mkdir()
Create a new single directory for this resource. This will not succeed if any parent directories needed for this resource to exist are missing. You should consider using mkdirs()


mkdirs

boolean mkdirs()
Create all directories required for this resource to exist.


deleteOnExit

void deleteOnExit()
Requests that the file or directory denoted by this resource be deleted when the virtual machine terminates.

Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care.


setContents

T setContents(String data)
Set the contents of this FileResource to the given String


setContents

T setContents(char[] data)
Set the contents of this FileResource to the given character array.


setContents

T setContents(InputStream data)
Set the contents of this FileResource to the contents of the given InputStream.


createNewFile

boolean createNewFile()
Create the file in the underlying resource system. Necessary directory paths will be created automatically.


createTempResource

T createTempResource()
Create a temporary FileResource


renameTo

boolean renameTo(String pathspec)
Rename this Resource to the given path.


renameTo

boolean renameTo(FileResource<?> target)
Rename this Resource to the given FileResource


getSize

long getSize()
Returns the size of the file denoted by this abstract pathname


isWritable

boolean isWritable()
Returns if a file is writable


isReadable

boolean isReadable()
Returns if a file is readable


isExecutable

boolean isExecutable()
Returns if a file is executable


Forge - Resource Addon API 2.0.0.Alpha3

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.