Class ZipUtils
java.lang.Object
ru.bgcrm.util.ZipUtils
ZIP utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ZipEntryaddEntry(ZipOutputStream zos, String name, String content) Add named entry in ZIP, and close it aftergetEntriesFromZip(ZipInputStream zis, String subst) Extracts entries from a ZIP by name substringgetFileEntriesFromZipByPrefix(ZipInputStream zis, String prefix) Extracts entries from ZIP by name prefix
-
Constructor Details
-
ZipUtils
public ZipUtils()
-
-
Method Details
-
addEntry
public static ZipEntry addEntry(ZipOutputStream zos, String name, String content) throws IOException Add named entry in ZIP, and close it after- Parameters:
zos- the ZIP output streamname- the entry namecontent- the entry content, encoded with UTF-8 if notnull- Returns:
- the created ZIP entry
- Throws:
IOException
-
getFileEntriesFromZipByPrefix
public static SortedMap<String,byte[]> getFileEntriesFromZipByPrefix(ZipInputStream zis, String prefix) Extracts entries from ZIP by name prefix- Parameters:
zis- the ZIP input streamprefix- the name prefix- Returns:
- the map of entry name to content, ordered by name
-
getEntriesFromZip
Extracts entries from a ZIP by name substring- Parameters:
zis- the ZIP input streamsubst- the name substring, matches all entries whennull- Returns:
- the map of entry name to content
-