Class WeakZipFileFactory
java.lang.Object
org.apache.felix.framework.util.WeakZipFileFactory
This class implements a factory for creating weak zip files, which behave
mostly like a ZipFile, but can be weakly closed to limit the number of
open files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class wraps a ZipFile to making it possible to weakly close it; this means the underlying zip file will be automatically reopened on demand if anyone tries to use it. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Mutexprivate final intprivate final List<WeakZipFileFactory.WeakZipFile> private static final SecureActionprivate final List<WeakZipFileFactory.WeakZipFile> private static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionWeakZipFileFactory(int limit) Constructs a weak zip file factory with the specified file limit. -
Method Summary
Modifier and TypeMethodDescriptionFactory method used to create weak zip files.(package private) List<WeakZipFileFactory.WeakZipFile> Only used for testing.(package private) List<WeakZipFileFactory.WeakZipFile> Only used for testing.
-
Field Details
-
WEAKLY_CLOSED
private static final int WEAKLY_CLOSED- See Also:
-
OPEN
private static final int OPEN- See Also:
-
CLOSED
private static final int CLOSED- See Also:
-
m_secureAction
-
m_zipFiles
-
m_openFiles
-
m_globalMutex
-
m_limit
private final int m_limit
-
-
Constructor Details
-
WeakZipFileFactory
public WeakZipFileFactory(int limit) Constructs a weak zip file factory with the specified file limit. A limit of zero signifies no limit.- Parameters:
limit- maximum number of open zip files at any given time.
-
-
Method Details
-
create
Factory method used to create weak zip files.- Parameters:
file- the target zip file.- Returns:
- the created weak zip file.
- Throws:
IOException- if the zip file could not be opened.
-
getZipZiles
List<WeakZipFileFactory.WeakZipFile> getZipZiles()Only used for testing.- Returns:
- unclosed weak zip files.
-
getOpenZipZiles
List<WeakZipFileFactory.WeakZipFile> getOpenZipZiles()Only used for testing.- Returns:
- open weak zip files.
-