|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.joe_e.file.Filesystem
public final class Filesystem
File
construction. This provides a capability-safe API for access to
files. A File object grants read and write access to a file or directory.
Due to limitations in Java, all file references are to textual file names, not
file descriptors. Multiple operations on a File may thus apply to different
incarnations of the file. For this reason, File objects are not immune
from time-of-check-to-time-of-use vulnerabilities (race conditions).
Method Summary | |
---|---|
static void |
checkName(String name)
Vets a filename. |
static File |
file(File folder,
String child)
Produce a File capability for a file contained in a folder. |
static long |
length(File file)
Gets the length of a file |
static ConstArray<File> |
list(File dir)
List the contents of a directory. |
static InputStream |
read(File file)
Opens an existing file for reading. |
static OutputStream |
writeNew(File file)
Creates a file for writing, if and only if the file does not already exist, and returns an OutputStream for writing to that file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static File file(File folder, String child) throws InvalidFilenameException
folder
- containing folderchild
- a single filename component, not a relative path
IllegalArgumentException
- if folder
is null or
the empty path
InvalidFilenameException
public static void checkName(String name) throws InvalidFilenameException
name
- a single filename component, not a relative path
InvalidFilenameException
- name
is rejectedpublic static ConstArray<File> list(File dir) throws IOException
dir
- directory to list
IOException
- dir
is not a directory, or an I/O errorpublic static long length(File file) throws FileNotFoundException
file
- file to stat
FileNotFoundException
- file
not foundpublic static InputStream read(File file) throws FileNotFoundException
file
- file to open
FileNotFoundException
- file
not foundpublic static OutputStream writeNew(File file) throws IOException
file
- file to create
IOException
- file
could not be created
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |