Class ZipJarUtil
java.lang.Object
eu.medsea.util.ZipJarUtil
Utility class providing methods to work with Zip and Jar Files
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CollectiongetEntries(File file) Get all entries from a Zip or Jar file.static CollectiongetEntries(String fileName) Get all entries from a Zip or Jar file.static CollectiongetEntries(URL url) Get all entries from a Zip or Jar file identified by a URL.static CollectiongetEntries(ZipFile zipFile) Get all entries from a zip or jar file.static InputStreamgetInputStreamForURL(URL url) Get an InputStream from the zip file capable of reading fromstatic void
-
Constructor Details
-
ZipJarUtil
public ZipJarUtil()
-
-
Method Details
-
getInputStreamForURL
Get an InputStream from the zip file capable of reading from- Parameters:
url-- Returns:
- InputStream for reading from a jar or zip file
- Throws:
IOException
-
getEntries
Get all entries from a Zip or Jar file. This defers to the getEntries(ZipFile zipFile) method Example of usage: Collection entries = ZipJarUtil.getEntries("src/test/resources/a.zip");- Parameters:
fileName- path identifying a zip or jar file- Returns:
- collection of Strings representing the entries in the zip or jar file
- Throws:
ZipExceptionIOException
-
getEntries
Get all entries from a Zip or Jar file. This defers to the getEntries(ZipFile zipFile) method Example of usage: Collection entries = ZipJarUtil.getEntries(new File("src/test/resources/a.zip"));- Parameters:
file- identifies a zip or jar file- Returns:
- collection of Strings representing the entries in the zip or jar file
- Throws:
ZipExceptionIOException
-
getEntries
Get all entries from a Zip or Jar file identified by a URL. Example of usage: Collection entries = ZipJarUtil.getEntries(new URL("jar:file:src/test/resources/a.zip!/")); This defers to the getEntries(ZipFile zipFile) method- Parameters:
url- identifying a jar or zip file. Can also refer to an entry, which is ignored.- Returns:
- collection of Strings representing the entries in the zip or jar file
- Throws:
ZipExceptionIOException
-
getEntries
Get all entries from a zip or jar file. Ignores directories- Parameters:
zipFile-- Returns:
- collection of Strings representing the entries in the zip or jar file
- Throws:
ZipExceptionIOException
-
main
-