Class ZipUtils

java.lang.Object
ru.bgcrm.util.ZipUtils

public class ZipUtils extends Object
ZIP utils
  • 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 stream
      name - the entry name
      content - the entry content, encoded with UTF-8 if not null
      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 stream
      prefix - the name prefix
      Returns:
      the map of entry name to content, ordered by name
    • getEntriesFromZip

      public static Map<String,byte[]> getEntriesFromZip(ZipInputStream zis, String subst)
      Extracts entries from a ZIP by name substring
      Parameters:
      zis - the ZIP input stream
      subst - the name substring, matches all entries when null
      Returns:
      the map of entry name to content