public abstract class VirtualDir extends Object
Constructor and Description |
---|
VirtualDir() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes access to this virtual directory.
|
static VirtualDir |
create(File file)
Creates an instance of a virtual directory object from a given directory or ZIP-file.
|
static File |
createUniqueTempDir() |
static void |
deleteFileTree(File treeRoot)
Deletes the directory
treeRoot and all the content recursively. |
abstract boolean |
exists(String path) |
protected void |
finalize() |
abstract File |
getBaseFile() |
abstract String |
getBasePath() |
abstract File |
getFile(String path)
Gets the file for the given relative path.
|
abstract InputStream |
getInputStream(String path)
Opens an input stream for the given relative file path.
|
Reader |
getReader(String path)
Opens a reader for the given relative path.
|
File |
getTempDir() |
abstract boolean |
isArchive() |
abstract boolean |
isCompressed() |
abstract String[] |
list(String path)
Returns an array of strings naming the files and directories in the
directory denoted by the given relative directory path.
|
abstract String[] |
listAllFiles()
Returns an array of strings naming the relative directory path
of all file names.
|
public abstract String getBasePath()
public abstract File getBaseFile()
public Reader getReader(String path) throws IOException
path
- The relative file path.IOException
- If the file does not exist or if it can't be opened for reading.public abstract InputStream getInputStream(String path) throws IOException
path
- The relative file path.IOException
- If the file does not exist or if it can't be opened for reading.public abstract File getFile(String path) throws IOException
path
- The relative file or directory path.IOException
- If the file or directory does not exist or if it can't be extracted from a ZIP-file.public abstract String[] list(String path) throws IOException
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
path
- The relative directory path.IOException
- If the directory given by the relative path does not exists.public abstract boolean exists(String path)
public abstract String[] listAllFiles() throws IOException
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
IOException
- If an I/O error is thrown when accessing the virtual dir.public abstract void close()
public static VirtualDir create(File file)
file
- A directory or a ZIP-file.null
if file
is not a directory or a ZIP-file or
the ZIP-file could not be opened for read access..public abstract boolean isCompressed()
public abstract boolean isArchive()
public File getTempDir() throws IOException
IOException
protected void finalize() throws Throwable
public static void deleteFileTree(File treeRoot)
treeRoot
and all the content recursively.treeRoot
- directory to be deletedpublic static File createUniqueTempDir() throws IOException
IOException
Copyright © 2014–2022 European Space Agency (ESA). All rights reserved.