|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.util.FileSystems
public class FileSystems
A utility class that contains static methods for working with
FileSystem
:s.
The methods in this class will use the locking strategy for utility classes
described in EntityLock
.
FileSystem
Method Summary | |
---|---|
static boolean |
entityExists(FileSystem fs,
AbsoluteLocation el)
Check if there exists an entity in the supplied location. |
static AbsoluteLocation |
getCanonicalLocation(FileSystem fs,
AbsoluteLocation l)
Return the canonical location for the given location in this file system. |
static Entity |
getEntity(FileSystem fs,
AbsoluteLocation el)
Get the entity identified by the absolute entity location. |
static Directory |
getEntityForDirectory(File d,
boolean readOnly)
Create a file system with the root in the given directory and return a Directory entity object representing it. |
static EFile |
getEntityForFile(File f,
boolean readOnly)
Create a file system with the root in the file's parent directory and return an EFile entity object representing the file. |
static Entity |
getEntityOrNull(FileSystem fs,
AbsoluteLocation el)
Get the entity identified by the absolute entity location. |
static EFile |
getTextFile(String s)
Creates an in-memory file system containing a text file that contains the provided text and returns the file object. |
static EFile |
getTextFile(String s,
FileSystem fs)
Create a text file containing the provided text in the provided file system's temporary files directory. |
static Directory |
putIfAbsentDirectory(FileSystem fs,
AbsoluteLocation el)
Get the directory that exists in the supplied absolute entity location. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean entityExists(FileSystem fs, AbsoluteLocation el) throws CircularReferenceException, AccessDeniedException
fs
- The file system.el
- The location of the entity.
true
if the entity exists in the file system, false
otherwise.
CircularReferenceException
- If there is a circular reference in a
chain of entity-accepting entities that have to be dereferenced in order
to find the entity.
AccessDeniedException
- If the calling thread does not have execute
access to a parent directory of the entity.public static Entity getEntity(FileSystem fs, AbsoluteLocation el) throws EntityNotFoundException, CircularReferenceException, AccessDeniedException
fs
- The file system.el
- The absolute location of the entity.
EntityNotFoundException
- If there is no entity in the absolute
location.
CircularReferenceException
- If there is a circular reference in a
chain of entity-accepting entities that have to be dereferenced in order
to find the entity.
AccessDeniedException
- If the calling thread does not have execute
access to a parent directory of the entity.getEntityOrNull(FileSystem, AbsoluteLocation)
public static Entity getEntityOrNull(FileSystem fs, AbsoluteLocation el) throws CircularReferenceException, AccessDeniedException
el
- An AbsoluteLocation
identifying the entity to return.
null
if there is no entity in that location.
CircularReferenceException
- If there is a circular reference in a
chain of entity-accepting entities that have to be dereferenced in order
to find the entity.
AccessDeniedException
- If the calling thread does not have execute
access to a parent directory of the entity.getEntity(FileSystem, AbsoluteLocation)
public static Directory putIfAbsentDirectory(FileSystem fs, AbsoluteLocation el) throws EntityFoundException, CircularReferenceException, AccessDeniedException
fs
- The file system.el
- The absolute location of the directory.
EntityFoundException
- If there is a non-directory entity somewhere
in the directory path so that the directory cannot be created.
CircularReferenceException
- If there is a circular reference in a
chain of entity-accepting entities that have to be dereferenced in order
to find the entity.
AccessDeniedException
- If the calling thread does not have
sufficient access rights.public static AbsoluteLocation getCanonicalLocation(FileSystem fs, AbsoluteLocation l) throws EntityNotFoundException, CircularReferenceException, AccessDeniedException
fs
- The file system.l
- The absolute entity location.
EntityNotFoundException
- If an entity denoted by the absolute
location does not exist.
CircularReferenceException
- If there is a circular reference in a
chain of entity-accepting entities that have to be dereferenced in order
to find the entity.
AccessDeniedException
- If the calling thread does not have execute
access to the entities necessary for creating the canonical location.File.getCanonicalFile()
,
Entities.getCanonicalLocation(EntityView)
public static EFile getEntityForFile(File f, boolean readOnly) throws NotAFileException, EntityNotFoundException
EFile
entity object representing the file.
The file system is created with the default configuration from
FSRWFileSystemBuilder
(or FSROFileSystemBuilder
if it is
read-only).
f
- The file to return the entity object for.readOnly
- Should the created file system be read only?
EntityNotFoundException
- If the file does not exist.
NotAFileException
- If the file is not a file.public static Directory getEntityForDirectory(File d, boolean readOnly) throws NotADirectoryException, EntityNotFoundException
Directory
entity object representing it.
The file system is created with the default configuration from
FSRWFileSystemBuilder
(or FSROFileSystemBuilder
if it is
read-only).
d
- The directory to return the entity object for.readOnly
- Should the created file system be read only?
EntityNotFoundException
- If the directory does not exist.
NotAFileException
- If the file object does not reference a
directory.
NotADirectoryException
public static EFile getTextFile(String s)
The returned file system does not do any entity locking, does not send any entity events and does not use any access controls.
s
- The contents of the text file.
public static EFile getTextFile(String s, FileSystem fs) throws IllegalArgumentException
s
- The contents of the text file.fs
- The file system.
IllegalArgumentException
- If the provided file system does not
have a temporary files directory set.FileSystem.setTemporaryFilesDirectory(Directory)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |