|
ref_send API 2.17 defensive programming in Java |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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.
Method Summary | |
---|---|
static void |
checkName(java.lang.String name)
Vets a filename. |
static java.io.File |
file(java.io.File folder,
java.lang.String child)
Produce a File capability for a file contained in a folder. |
static long |
length(java.io.File file)
Gets the length of a file |
static ConstArray<java.io.File> |
list(java.io.File dir)
List the contents of a directory. |
static java.io.InputStream |
read(java.io.File file)
Opens an existing file for reading. |
static java.io.OutputStream |
writeNew(java.io.File file)
Creates a file for writing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.io.File file(java.io.File folder, java.lang.String child) throws InvalidFilenameException
folder
- containing folderchild
- a single filename component, not a relative path
java.lang.IllegalArgumentException
- if folder
is null or
the empty path
InvalidFilenameException
public static void checkName(java.lang.String name) throws InvalidFilenameException
name
- a single filename component, not a relative path
InvalidFilenameException
- name
is rejected\public static ConstArray<java.io.File> list(java.io.File dir) throws java.io.IOException
dir
- directory to list
java.io.IOException
- dir
is not a directory, or an I/O errorpublic static long length(java.io.File file) throws java.io.FileNotFoundException
file
- file to stat
java.io.FileNotFoundException
- file
not foundpublic static java.io.InputStream read(java.io.File file) throws java.io.FileNotFoundException
file
- file to open
java.io.FileNotFoundException
- file
not foundpublic static java.io.OutputStream writeNew(java.io.File file) throws java.io.IOException
file
- file to create
java.io.IOException
- file
could not be created
|
ref_send API 2.17 defensive programming in Java |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.