|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.filestorm.file.FileStore
public class FileStore
An instance of this class implements the Store interface over
the file system.
It should be noted that the names used to perform put/get/delete operations will
be interpreted as full paths in a hierarchical file structure. That is: a put operation
with which a name such as dir1/dir2/file.txt is used will trigger the
hierarchical creation of directories dir1 and dir2, under
which data will be kept in the a file named file.txt.
| Field Summary | |
|---|---|
protected File |
_baseDir
|
protected int |
_bufsz
|
protected org.apache.commons.logging.Log |
_log
|
| Constructor Summary | |
|---|---|
FileStore(File baseDir,
int bufSize)
|
|
| Method Summary | |
|---|---|
void |
cleanup()
|
void |
close()
Closes this instance. |
boolean |
contains(String name)
|
void |
delete(String name)
|
InputStream |
get(String name)
|
void |
get(String name,
OutputStream out)
Streams the data corresponding to the given name into the given stream. |
long |
getContentLength(String name)
|
long |
getLastModified(String name)
|
String[] |
list(String baseName)
Returns the list of names corresponding to stored data, relative to the given base name. |
OutputStream |
put(String name)
|
void |
put(String name,
InputStream data)
Stores the data corresponding to the given stream under the named passed in. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _bufsz
protected File _baseDir
protected org.apache.commons.logging.Log _log
| Constructor Detail |
|---|
public FileStore(File baseDir,
int bufSize)
throws IOException
baseDir - the base directory of this instance.bufSize - the size of buffers that are internally used for data transfer.
IOException - if an IO problem occurs when creating the instance.| Method Detail |
|---|
public void put(String name,
InputStream data)
throws IOException
Store
put in interface Storename - the name under which to keep the passed in data.data - an InputStream containing data to save.
IOException - if an IO problem occurs while performing this operation.
public OutputStream put(String name)
throws IOException
IOException
public InputStream get(String name)
throws FileNotFoundException,
IOException
get in interface Storename - the name corresponding to the data to retrieve.
FileNotFoundException - if no data exists for the given name.
IOException - if an IO problem occurs while performing this operation.
public void get(String name,
OutputStream out)
throws FileNotFoundException,
IOException
Store
get in interface Storename - the name corresponding to the data to retrieve.out - an OutputStream to which the data is to be written.
FileNotFoundException - if no data exists for the given name.
IOException - if an IO problem occurs while performing this operation.
public String[] list(String baseName)
throws IOException
Storesome/path/to/file,
the file fragment will be relative to some/path/to (therefore,
passing some/path/to as a base name to this method would return all names
immediately "under" that base name).
If the passed in base name is null or is an empty string, then the returned
names will be returned relatively to the "root" of this instance.
list in interface StorebaseName - a base name.
IOException
public void delete(String name)
throws IOException
delete in interface Storename - the name corresponding to the data to delete.
IOException - if an IO problem occurs while performing this operation.
public boolean contains(String name)
throws IOException
contains in interface Storename - the name corresponding to the data whose existence must be checked.
IOException
public long getContentLength(String name)
throws FileNotFoundException,
IOException
getContentLength in interface Storename - the name corresponding to the data whose length must be returned.
FileNotFoundException
IOException
public long getLastModified(String name)
throws FileNotFoundException,
IOException
getLastModified in interface Storename - the name corresponding to the data whose timestamp must be returned..
millis, at which the data was last modified.
FileNotFoundException
IOExceptionpublic void close()
Store
close in interface Storepublic void cleanup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||