Class ZipBuilder


  • public class ZipBuilder
    extends Object
    Utility class for building ZIP archive stream.
    • Constructor Detail

      • ZipBuilder

        public ZipBuilder()
    • Method Detail

      • writeEntry

        public void writeEntry​(String name,
                               byte[] content)
                        throws IOException
        Creates new ZIP archive entry.
        Parameters:
        name - Entry stackSetName.
        content - Binary content of the file.
        Throws:
        IOException - When writing content to archive fails.
      • writeEntry

        public void writeEntry​(String name,
                               InputStream stream)
                        throws IOException
        Creates new ZIP archive entry.
        Parameters:
        name - Entry stackSetName.
        stream - Content source.
        Throws:
        IOException - When writing content to archive fails.
      • copyFrom

        public void copyFrom​(ZipInputStream archive)
                      throws IOException
        Copies another archive into current one.
        Parameters:
        archive - Source.
        Throws:
        IOException - When reading source archive fails.
      • dump

        public ByteBuffer dump()
                        throws IOException
        Closes active stream.
        Returns:
        Archive binary content.
        Throws:
        IOException - When dumping ZIP stream fails.