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