Package org.apache.maven.index.util.zip
Interface ZipHandle
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
AbstractZipHandle
,JavaZipFileHandle
public interface ZipHandle extends java.io.Closeable
A very simplistic approach to hide the underlying mech to deal with ZipFiles, suited for use cases happening in Maven Indexer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the zip handle (performs resource cleanup).java.util.List<java.lang.String>
getEntries()
Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.java.util.List<java.lang.String>
getEntries(EntryNameFilter filter)
Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.java.io.InputStream
getEntryContent(java.lang.String path)
Returns the "payload" (uncompressed) of the entry at given path, or null if no such path exists in the Zip file this handle points to.boolean
hasEntry(java.lang.String path)
Returns true if Zip file this handle is pointing to contains an entry at given path.
-
-
-
Method Detail
-
hasEntry
boolean hasEntry(java.lang.String path) throws java.io.IOException
Returns true if Zip file this handle is pointing to contains an entry at given path.- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
-
getEntries
java.util.List<java.lang.String> getEntries()
Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.- Returns:
-
getEntries
java.util.List<java.lang.String> getEntries(EntryNameFilter filter)
Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.- Returns:
-
getEntryContent
java.io.InputStream getEntryContent(java.lang.String path) throws java.io.IOException
Returns the "payload" (uncompressed) of the entry at given path, or null if no such path exists in the Zip file this handle points to.- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
-
close
void close() throws java.io.IOException
Closes the zip handle (performs resource cleanup). This method should be called when this zip handle is not needed anymore, and calling it should be obligatory to prevent resource leaks.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-