|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlumis.portal.serialization.persistency.zip.ZipDirectory
public class ZipDirectory
IDirectory
implementation that uses a zip file as the concrete repository.
This implementation allows only one open stream at a time. Tries to get some input or output stream when another stream was got and not closed yet will raise an StreamStillOpenException
.
Constructor Summary | |
---|---|
ZipDirectory(java.io.File zipFile)
|
|
ZipDirectory(java.io.File zipFile,
boolean createIfNotExist)
|
|
ZipDirectory(java.lang.String zipFilePath)
|
Method Summary | |
---|---|
void |
close()
|
void |
delete()
Delete the repository. |
boolean |
exists(java.lang.String filePath)
Check the existence of a file. |
protected void |
finalize()
|
java.lang.String |
getDescription()
Generate a general description of the directory, used mainly to compose exception messages. |
java.lang.String |
getDirectoryPath()
|
java.io.InputStream |
getInputStream(java.lang.String filePath)
Get an InputStream to a repository file. |
java.io.OutputStream |
getOutputStream(java.lang.String filePath)
Get an OutputStream to a repository file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZipDirectory(java.lang.String zipFilePath) throws java.io.FileNotFoundException
zipFilePath
- path to the zip file.
java.io.FileNotFoundException
- if the zip file was not found.public ZipDirectory(java.io.File zipFile) throws java.io.FileNotFoundException
zipFile
- File
that wraps the zip file.
java.io.FileNotFoundException
- if the zip file was not found.public ZipDirectory(java.io.File zipFile, boolean createIfNotExist) throws java.io.FileNotFoundException, java.io.IOException
zipFile
- File
that wraps the zip file.createIfNotExist
- if true, the zip file will be created if it does not exist.
java.io.FileNotFoundException
- if the zip file was not found and createIfNotExist=false.
java.io.IOException
Method Detail |
---|
public boolean exists(java.lang.String filePath) throws java.io.IOException
exists
in interface IDirectory
filePath
- path to the file to be checked.
java.lang.IllegalStateException
- if this method is called in an already closed instance.
java.io.IOException
- if an I/O error occurs.public java.lang.String getDescription()
IDirectory
getDescription
in interface IDirectory
public java.io.InputStream getInputStream(java.lang.String filePath) throws StreamStillOpenException, java.io.FileNotFoundException, java.io.IOException
InputStream
to a repository file.
This implementation does not allow more than one stream open at a time.
getInputStream
in interface IDirectory
filePath
- path to the file.
InputStream
to file found in specified filePath.
StreamStillOpenException
- if there is another stream that was gotten and not closed yet.
java.lang.IllegalStateException
- if this method is called in an already closed instance.
java.io.FileNotFoundException
- if no file was found in specified filePath.
java.io.IOException
- if an I/O error occurs.public java.io.OutputStream getOutputStream(java.lang.String filePath) throws StreamStillOpenException, java.io.IOException
OutputStream
to a repository file.
Due to an output optimization, this implementation does not persist the new files just after closing the OutputStream
. To commit the persistence, the method close()
must be called.
This implementation does not allow more than one stream open at a time.
If the file already exists, an IOException
will be thrown.
getOutputStream
in interface IDirectory
filePath
- path to the file.
OutputStream
to the new file
StreamStillOpenException
- if there is another stream that was gotten and not closed yet.
java.lang.IllegalStateException
- if this method is called in an already closed instance.
java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
In this implementation, this method MUST be called in order to persist new added files.
close
in interface java.io.Closeable
java.io.IOException
public void delete() throws java.io.IOException
IDirectory
delete
in interface IDirectory
java.io.IOException
- if an I/O error occurs.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String getDirectoryPath()
getDirectoryPath
in interface IFSDirectory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |