de.esprit.appsuite.io.archive.zip

## Class ZipArchiver<C extends ApplicationContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.AbstractAsyncExecutable<C>
      - - de.esprit.appsuite.io.archive.AbstractArchiver<C>
        - - de.esprit.appsuite.io.archive.zip.ZipArchiver<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, CancellableTask, TaskMonitorSupport, SimpleLogSupport, Dumpable, Executable

      public class ZipArchiver<C extends ApplicationContext>
      extends AbstractArchiver<C>

  This class is supposed to create a ZIP archive from either files/directories or directly from any input-streams. The result is a zipped archive file.
  Author:
    Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.io.archive.AbstractArchiver

      `measureStream`

    - ### Fields inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `childTaskRef, isTestMode, monitorController, resultRef, stateFlag`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZipArchiver(C ctx)`
    `ZipArchiver(C ctx, ArchiveInputList inputList)`
    `ZipArchiver(C ctx, java.io.File zipOutFile)`
    `ZipArchiver(C ctx, java.io.File zipOutFile, ArchiveInputList inputList)`
    `ZipArchiver(C ctx, LogChannel logCh, java.io.File zipOutFile, ArchiveInputList inputList)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addZipEntry(java.io.InputStream inStream, java.lang.String entryName)` Allows for dynamically adding a stream entry during execution.
    `FileType` | `getArchiveType()`
    `protected void` | `performFillArchive()` May be overridden to add zip-entries during execution.
    `protected void` | `processArchiving(java.io.File archiveFile, ArchiveInputList inputList)`
    `void` | `setCompressionLevel(CompressionLevel level)` Defines the level of compression for the archiver.
    `void` | `setEncoding(java.lang.String encoding)` Allows for setting the encoding for the used `ZipOutputStream`.

    - ### Methods inherited from class de.esprit.appsuite.io.archive.AbstractArchiver

      `addDirectory, addDirectory, addFile, addFiles, checkDirectoryExists, checkFileExists, checkHasArchivedFiles, createCleanupFileOutputStream, doOnAddingArchiveEntry, executeAsync, getSourceRootDir, incrementArchivedFileCount, setArchiveFile, setRemoveSourceFiles, setRootDirectory, setSourceRootDir`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, handleFinish, handleStart, handleSuccess, hasError, hasMonitor, isCancellable, notifyProceeded, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.appsuite.launch.ApplicationObject

      `getApplicationContext`

    - ### Methods inherited from interface de.esprit.common.log.SimpleLogSupport

      `getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

- - ### Constructor Detail

    - #### ZipArchiver

          public ZipArchiver(C ctx)

    - #### ZipArchiver

          public ZipArchiver(C ctx,
                     java.io.File zipOutFile)

    - #### ZipArchiver

          public ZipArchiver(C ctx,
                     ArchiveInputList inputList)

    - #### ZipArchiver

          public ZipArchiver(C ctx,
                     java.io.File zipOutFile,
                     ArchiveInputList inputList)

    - #### ZipArchiver

          public ZipArchiver(C ctx,
                     LogChannel logCh,
                     java.io.File zipOutFile,
                     ArchiveInputList inputList)

  - ### Method Detail

    - #### setEncoding

          public void setEncoding(java.lang.String encoding)

      Allows for setting the encoding for the used `ZipOutputStream`. Note that on windows platforms the encoding IBM437 serves best for german Umlaute.

    - #### getArchiveType

          public FileType getArchiveType()

      Specified by:
        `getArchiveType` in class `AbstractArchiver<C extends ApplicationContext>`

    - #### setCompressionLevel

          public void setCompressionLevel(CompressionLevel level)

      Defines the level of compression for the archiver.

    - #### addZipEntry

          public void addZipEntry(java.io.InputStream inStream,
                         java.lang.String entryName)
                           throws java.lang.Exception

      Allows for dynamically adding a stream entry during execution. May be used from within `performFillArchive()`.
      Throws:
        `java.lang.Exception`

    - #### performFillArchive

          protected void performFillArchive()
                                     throws java.lang.Exception

      May be overridden to add zip-entries during execution.
      Throws:
        `java.lang.Exception`
      See Also:
        `addZipEntry(InputStream, String)`

    - #### processArchiving

          protected final void processArchiving(java.io.File archiveFile,
                              ArchiveInputList inputList)
                                         throws java.lang.Exception

      Specified by:
        `processArchiving` in class `AbstractArchiver<C extends ApplicationContext>`
      Throws:
        `java.lang.Exception`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.