public abstract class BaseFileSystem extends Object implements FileSystem
FileSystem that all implementations should extend from.| Constructor and Description |
|---|
BaseFileSystem() |
| Modifier and Type | Method and Description |
|---|---|
protected Entry |
get(DirectoryEntry parent,
String name)
Gets the named entry in the specified directory.
|
Entry |
get(String path)
Returns the entry at the specified path.
|
DirectoryEntry |
getRoot()
Returns the root directory entry.
|
DirectoryEntry |
mkdir(DirectoryEntry parent,
String name)
Makes the specified child directory.
|
FileEntry |
put(DirectoryEntry parent,
String name,
byte[] content)
Puts the specified content into a the specified directory.
|
FileEntry |
put(DirectoryEntry parent,
String name,
InputStream content)
Puts the specified content into a the specified directory.
|
void |
remove(Entry entry)
Removes the specified entry (and if the entry is a directory, all its children).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLastModified, listEntriespublic DirectoryEntry getRoot()
getRoot in interface FileSystempublic Entry get(String path)
null result proves the path does not exist, however
very lazy caching implementations may return a non-null entry for paths which do not exist.get in interface FileSystempath - the path to retrieve the Entry of.Entry or null if the path definitely does not exist.protected Entry get(DirectoryEntry parent, String name)
parent - the directory.name - the name of the entry to get.Entry or null if the entry does not exist.public DirectoryEntry mkdir(DirectoryEntry parent, String name)
mkdir in interface FileSystemparent - the directory in which the child is to be created.name - the name of the child directory.public FileEntry put(DirectoryEntry parent, String name, InputStream content) throws IOException
put in interface FileSystemparent - the directory in which the content is to be created/updated.name - the name of the file.content - the content (implementer is responsible for closing).FileEntry that was created/updated.IOException - if the content could not be read/written.public FileEntry put(DirectoryEntry parent, String name, byte[] content) throws IOException
put in interface FileSystemparent - the directory in which the content is to be created/updated.name - the name of the file.content - the content.FileEntry that was created/updated.IOException - if the content could not be read/written.public void remove(Entry entry)
remove in interface FileSystementry - the entry to remove.Copyright © 2009–2022 MojoHaus. All rights reserved.