Class ZipDirectoryTasklet

  • All Implemented Interfaces:
    org.springframework.batch.core.step.tasklet.Tasklet

    public class ZipDirectoryTasklet
    extends java.lang.Object
    implements org.springframework.batch.core.step.tasklet.Tasklet
    Compresses the given directory into a zip-file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.batch.repeat.RepeatStatus execute​(org.springframework.batch.core.StepContribution contribution, org.springframework.batch.core.scope.context.ChunkContext chunkContext)  
      static void pack​(org.springframework.core.io.FileSystemResource sourceDirPath, org.springframework.core.io.FileSystemResource zipFilePath)  
      void setDestFile​(org.springframework.core.io.FileSystemResource destFile)  
      void setSourceDir​(org.springframework.core.io.FileSystemResource sourceDir)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZipDirectoryTasklet

        public ZipDirectoryTasklet()
    • Method Detail

      • execute

        public org.springframework.batch.repeat.RepeatStatus execute​(org.springframework.batch.core.StepContribution contribution,
                                                                     org.springframework.batch.core.scope.context.ChunkContext chunkContext)
                                                              throws java.lang.Exception
        Specified by:
        execute in interface org.springframework.batch.core.step.tasklet.Tasklet
        Throws:
        java.lang.Exception
      • pack

        public static void pack​(org.springframework.core.io.FileSystemResource sourceDirPath,
                                org.springframework.core.io.FileSystemResource zipFilePath)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • setSourceDir

        public void setSourceDir​(org.springframework.core.io.FileSystemResource sourceDir)
        Parameters:
        sourceDir - The directory to be zipped
      • setDestFile

        public void setDestFile​(org.springframework.core.io.FileSystemResource destFile)
        Parameters:
        destFile - Destination zip file