DirectoryManagerImplpublic interface DirectoryManager
| Modifier and Type | Method | Description |
|---|---|---|
long |
createFile(String fileName,
InputStream inputStream) |
Creates a new file in the current directory, and fill it with the data
from the given input stream.
|
void |
createFile(String fileName,
String fileContents) |
Creates a new file in the current directory, and fill it with the given
data, encoded in UTF-8.
|
long |
createFileAtomic(String fileName,
InputStream inputStream) |
Creates a new file in the current directory, and fill it with the data
from the given input stream.
|
InputStream |
getInputStreamForFile(String fileName,
CompressionType compressionType) |
Returns an input stream to access file of the given name within the
current directory, possibly uncompressing it if required.
|
OutputStream |
getOutputStreamForFile(String fileName) |
Opens and returns an output stream that can be used to write to the file
of the given name within the current directory.
|
List<String> |
getSubdirectories(String glob) |
Returns a list of the names of all subdirectories of the base directory.
|
DirectoryManager |
getSubdirectoryManager(String subdirectoryName) |
Returns a new directory manager for the subdirectory of the given name.
|
boolean |
hasFile(String fileName) |
Checks if there is a file of the given name.
|
boolean |
hasSubdirectory(String subdirectoryName) |
Checks if there is a subdirectory of the given name.
|
DirectoryManager getSubdirectoryManager(String subdirectoryName) throws IOException
hasSubdirectory(String) first (ignoring the fact that there
might be race conditions when accessing the file system).subdirectoryName - the string name of the subdirectoryIOException - if directory could not be createdboolean hasSubdirectory(String subdirectoryName)
subdirectoryName - the name of the subdirectoryboolean hasFile(String fileName)
fileName - the name of the filelong createFile(String fileName, InputStream inputStream) throws IOException
fileName - the name of the fileinputStream - the input stream from which to load the fileIOExceptionlong createFileAtomic(String fileName, InputStream inputStream) throws IOException
If the stream encodes a string, then it should generally be encoded in UTF-8, since access methods assume this.
fileName - the name of the fileinputStream - the input stream from which to load the fileIOExceptionvoid createFile(String fileName, String fileContents) throws IOException
fileName - the name of the filefileContents - the data to write into the fileIOExceptionOutputStream getOutputStreamForFile(String fileName) throws IOException
fileName - the name of the fileIOExceptionInputStream getInputStreamForFile(String fileName, CompressionType compressionType) throws IOException
It is important to close the stream after using it to free memory.
fileName - the name of the filecompressionType - for types other than CompressionType.NONE, the file
will be uncompressed appropriately and the returned input
stream will provide access to the uncompressed contentIOExceptionList<String> getSubdirectories(String glob) throws IOException
glob - pattern to filter directoy namesIOExceptionCopyright © 2014–2017 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage