public class WeakZipFileFactory.WeakZipFile
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
WeakZipFileFactory.WeakZipFile.WeakZipInputStream
This is an InputStream wrapper that will properly reopen the underlying
zip file if it is weakly closed and create the underlying input stream.
|
| Modifier and Type | Field and Description |
|---|---|
private java.lang.ref.SoftReference<java.util.List<java.util.zip.ZipEntry>> |
m_entries |
private java.io.File |
m_file |
private Mutex |
m_localMutex |
private int |
m_status |
private long |
m_timestamp |
private java.util.zip.ZipFile |
m_zipFile |
| Modifier | Constructor and Description |
|---|---|
private |
WeakZipFile(java.io.File file)
Constructor is private since instances need to be centrally
managed.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
__close()
This internal method is used to clear the zip file from the data
structures and reset its state.
|
private void |
__reopenZipFile()
Thie internal method is used to reopen a weakly closed zip file.
|
private void |
_closeWeakly()
This method is used internally to weakly close a zip file.
|
void |
close()
This method permanently closes the zip file.
|
(package private) void |
closeWeakly()
Weakly closes the zip file, which means that it will be reopened
if anyone tries to use it again.
|
private void |
ensureZipFileIsOpen()
This method ensures that the zip file associated with this
weak zip file instance is actually open and acquires the
local weak zip file mutex.
|
java.util.Enumeration<java.util.zip.ZipEntry> |
entries()
Returns an enumeration of zip entries from the zip file.
|
java.util.zip.ZipEntry |
getEntry(java.lang.String name)
Returns the specified entry from the zip file.
|
java.io.InputStream |
getInputStream(java.util.zip.ZipEntry ze)
Returns an input stream for the specified zip entry.
|
private final java.io.File m_file
private final Mutex m_localMutex
private java.util.zip.ZipFile m_zipFile
private int m_status
private long m_timestamp
private volatile java.lang.ref.SoftReference<java.util.List<java.util.zip.ZipEntry>> m_entries
private WeakZipFile(java.io.File file)
throws java.io.IOException
file - the target zip file.java.io.IOException - if the zip file could not be opened.public java.util.zip.ZipEntry getEntry(java.lang.String name)
name - the name of the entry to return.public java.util.Enumeration<java.util.zip.ZipEntry> entries()
public java.io.InputStream getInputStream(java.util.zip.ZipEntry ze)
throws java.io.IOException
ze - the zip entry whose input stream is to be retrieved.java.io.IOException - if the input stream cannot be opened.void closeWeakly()
private void _closeWeakly()
public void close()
throws java.io.IOException
java.io.IOException - if any error occurs while trying to close the
zip file.private void __close()
private void ensureZipFileIsOpen()
private void __reopenZipFile()
throws java.io.IOException
java.io.IOException