Class ZipUtils


  • public class ZipUtils
    extends Object
    Class to unzip the packets
    Since:
    1.0.0
    Author:
    Sowmya
    • Method Detail

      • unzipAndGetFile

        public static InputStream unzipAndGetFile​(InputStream packetStream,
                                                  String file)
                                           throws IOException
        Method to unzip the file in-memeory and search the required file and return it
        Parameters:
        packetStream - zip file to be unzipped
        file - file to search within zip file
        Returns:
        return the corresponding file as inputStream
        Throws:
        IOException - if any error occored while unzipping the file
      • unzipAndCheckIsFileExist

        public static boolean unzipAndCheckIsFileExist​(InputStream packetStream,
                                                       String file)
                                                throws IOException
        Method to unzip the file in-memeory and search the required file exists
        Parameters:
        packetStream - zip file to be unzipped
        file - file to search within zip file
        Returns:
        return true if found the required file, false otherwise
        Throws:
        IOException - if any error occored while unzipping the file
      • unZipFromInputStream

        public static void unZipFromInputStream​(InputStream input,
                                                String desDir)
                                         throws IOException
        Method to unzip the file for passed destination path
        Parameters:
        input - zip file to be unzipped
        desDir - location where to unzip the files
        Throws:
        IOException - if any error occurred while unzipping