public interface FileSystem
FileSystem
interface is an abstraction of a virtual
file system. The similarities of its method names with with the methods
of the java.io.File
class are intentional.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEPARATOR
File separator
|
static char |
SEPARATOR_CHAR
File separator character
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file system.
|
void |
createFolder(java.lang.String folderPath)
Creates the folder named by this path, including any necessary but
nonexistent parent folders.
|
void |
deleteFile(java.lang.String filePath)
Deletes the file denoted by this path.
|
void |
deleteFolder(java.lang.String folderPath)
Deletes the folder denoted by this path.
|
boolean |
exists(java.lang.String path)
Tests whether the file system entry denoted by this path exists.
|
java.io.InputStream |
getInputStream(java.lang.String filePath)
Returns an input stream of the contents of the file denoted by this path.
|
java.io.OutputStream |
getOutputStream(java.lang.String filePath)
Returns an output stream for writing bytes to the file denoted by this path.
|
boolean |
hasChildren(java.lang.String path)
Tests whether the file system entry denoted by this path has child entries.
|
void |
init()
Initialize the file system
|
boolean |
isFile(java.lang.String path)
Tests whether the file system entry denoted by this path exists and
is a file.
|
boolean |
isFolder(java.lang.String path)
Tests whether the file system entry denoted by this path exists and
is a folder.
|
long |
lastModified(java.lang.String path)
Returns the time that the file system entry denoted by this path
was last modified.
|
long |
length(java.lang.String filePath)
Returns the length of the file denoted by this path.
|
java.lang.String[] |
list(java.lang.String folderPath)
Returns an array of strings naming the files and folders
in the folder denoted by this path.
|
java.lang.String[] |
listFiles(java.lang.String folderPath)
Returns an array of strings naming the files in the folder
denoted by this path.
|
java.lang.String[] |
listFolders(java.lang.String folderPath)
Returns an array of strings naming the folders in the folder
denoted by this path.
|
static final java.lang.String SEPARATOR
static final char SEPARATOR_CHAR
void init() throws FileSystemException
FileSystemException
- if the file system initialization failsvoid close() throws FileSystemException
FileSystemException
java.io.InputStream getInputStream(java.lang.String filePath) throws FileSystemException
filePath
- the path of the file.FileSystemException
- if the file does not exist
or if it cannot be read fromjava.io.OutputStream getOutputStream(java.lang.String filePath) throws FileSystemException
filePath
- the path of the file.FileSystemException
- if the file cannot be written to or createdvoid createFolder(java.lang.String folderPath) throws FileSystemException
folderPath
- the path of the folder to be created.FileSystemException
- if a file system entry denoted by path
already exists or if another error occurs.boolean exists(java.lang.String path) throws FileSystemException
path
- the path of a file system entry.FileSystemException
boolean isFile(java.lang.String path) throws FileSystemException
path
- the path of a file system entry.FileSystemException
boolean isFolder(java.lang.String path) throws FileSystemException
path
- the path of a file system entry.FileSystemException
boolean hasChildren(java.lang.String path) throws FileSystemException
path
- the path of a file system entry.FileSystemException
long length(java.lang.String filePath) throws FileSystemException
filePath
- the path of the file.FileSystemException
- if the path does not denote an existing file.long lastModified(java.lang.String path) throws FileSystemException
path
- the path of a file system entry.FileSystemException
- if the file system entry does not exist.java.lang.String[] list(java.lang.String folderPath) throws FileSystemException
folderPath
- the path of the folder whose contents is to be listed.FileSystemException
- if this path does not denote a folder or if
another error occurs.java.lang.String[] listFiles(java.lang.String folderPath) throws FileSystemException
folderPath
- the path of the folder whose contents is to be listed.FileSystemException
- if this path does not denote a folder or if
another error occurs.java.lang.String[] listFolders(java.lang.String folderPath) throws FileSystemException
folderPath
- the path of the folder whose contents is to be listed.FileSystemException
- if this path does not denote a folder or if
another error occurs.void deleteFile(java.lang.String filePath) throws FileSystemException
filePath
- the path of the file to be deleted.FileSystemException
- if this path does not denote a file or if
another error occurs.void deleteFolder(java.lang.String folderPath) throws FileSystemException
folderPath
- the path of the folder to be deleted.FileSystemException
- if this path does not denote a folder or if
another error occurs.Copyright © 2010 - 2020 Adobe. All Rights Reserved