public class FileStorage extends StreamingStorage
Constructor and Description |
---|
FileStorage(File file)
Creates a storage instance for the specified file.
|
Modifier and Type | Method and Description |
---|---|
OutputStream |
createAppendStream()
Creates an output stream to append new content to the storage.
|
InputStream |
createInputStream()
Creates an input stream to read storage content.
|
OutputStream |
createOutputStream()
Creates an output stream to replace the storage with new content.
|
boolean |
delete()
Deletes the storage.
|
boolean |
exists()
Determines whether the storage already exists.
|
Date |
getCreationDate()
Returns the creation date of the storage.
|
protected File |
getFile()
Returns the file where to store the data.
|
String |
toString() |
public FileStorage(File file)
file
- the file where to store the data.protected final File getFile()
public final boolean exists()
StreamingStorage
exists
in class StreamingStorage
public Date getCreationDate() throws IOException
StreamingStorage
getCreationDate
in class StreamingStorage
IOException
- if the creation date cannot be determined.public InputStream createInputStream() throws IOException, TrsStoreCorruptedException
StreamingStorage
createInputStream
in class StreamingStorage
IOException
- if the storage cannot be read.TrsStoreCorruptedException
- if the storage is corrupted.public OutputStream createOutputStream() throws IOException
StreamingStorage
createOutputStream
in class StreamingStorage
IOException
- if the storage cannot be written.public OutputStream createAppendStream() throws IOException
StreamingStorage
createAppendStream
in class StreamingStorage
IOException
- if the storage cannot be written.public final boolean delete()
StreamingStorage
delete
in class StreamingStorage
true
if the storage was successfully deleted; false
otherwise.