Package io.roastedroot.zerofs
Class DirectoryEntry
java.lang.Object
io.roastedroot.zerofs.DirectoryEntry
Entry in a directory, containing references to the directory itself, the file the entry links to
and the name of the entry.
May also represent a non-existent entry if the name does not link to any file in the directory.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the directory containing this entry.booleanbooleanexists()Returnstrueif and only if this entry represents an existing file.file()Returns the file this entry links to.Returns the file this entry links to ornullif the file does not existinthashCode()name()Returns the name of this entry.requireDirectory(Path pathForException) Checks that this entry exists and links to a directory, throwing an exception if not.requireDoesNotExist(Path pathForException) Checks that this entry does not exist, throwing an exception if it does.requireExists(Path pathForException) Checks that this entry exists, throwing an exception if not.requireSymbolicLink(Path pathForException) Checks that this entry exists and links to a symbolic link, throwing an exception if not.toString()
-
Field Details
-
directory
-
name
-
file
-
next
DirectoryEntry next
-
-
Constructor Details
-
DirectoryEntry
-
-
Method Details
-
exists
public boolean exists()Returnstrueif and only if this entry represents an existing file. -
requireExists
Checks that this entry exists, throwing an exception if not.- Returns:
- this
- Throws:
NoSuchFileException- if this entry does not exist
-
requireDoesNotExist
Checks that this entry does not exist, throwing an exception if it does.- Returns:
- this
- Throws:
FileAlreadyExistsException- if this entry does not exist
-
requireDirectory
public DirectoryEntry requireDirectory(Path pathForException) throws NoSuchFileException, NotDirectoryException Checks that this entry exists and links to a directory, throwing an exception if not.- Returns:
- this
- Throws:
NoSuchFileException- if this entry does not existNotDirectoryException- if this entry does not link to a directory
-
requireSymbolicLink
public DirectoryEntry requireSymbolicLink(Path pathForException) throws NoSuchFileException, NotLinkException Checks that this entry exists and links to a symbolic link, throwing an exception if not.- Returns:
- this
- Throws:
NoSuchFileException- if this entry does not existNotLinkException- if this entry does not link to a symbolic link
-
directory
Returns the directory containing this entry. -
name
Returns the name of this entry. -
file
Returns the file this entry links to.- Throws:
IllegalStateException- if the file does not exist
-
fileOrNull
Returns the file this entry links to ornullif the file does not exist -
equals
-
hashCode
public int hashCode() -
toString
-