de.esprit.appsuite.io

## Class CleanupFileOutputStream<T extends AsyncExecutable>

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FileOutputStream
    - - de.esprit.appsuite.io.CleanupFileOutputStream<T>

- All Implemented Interfaces:
    SimpleLogSupport, java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

      public class CleanupFileOutputStream<T extends AsyncExecutable>
      extends java.io.FileOutputStream
      implements SimpleLogSupport

  This is a `FileOutputStream` which ensures that the output file is deleted in case of cancellation or error.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CleanupFileOutputStream(T task, java.io.File file)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `java.io.File` | `getFile()`
    `LogChannel` | `getLogChannel()`
    `T` | `getTask()`
    `boolean` | `hasError()`
    `boolean` | `isLogDebug()`
    `boolean` | `isLogVerbose()`
    `void` | `logDebug(java.lang.String message)`
    `void` | `logDump(java.lang.String message)`
    `void` | `logError(java.lang.String message)`
    `void` | `logError(java.lang.String message, java.lang.Exception e)`
    `void` | `logFatal(java.lang.String message, java.lang.Exception e)`
    `protected void` | `logFileClosed(java.io.File file)`
    `protected void` | `logFileCreated(java.io.File file)`
    `protected void` | `logFileDeleted(java.io.File file)`
    `void` | `logInfo(java.lang.String message)`
    `void` | `logVerbose(java.lang.String message)`
    `void` | `logWarning(java.lang.String message)`
    `void` | `setDeleteFileOnCancel(boolean isDeleteOnCancel)`
    `void` | `setDeleteFileOnError(boolean isDeleteOnError)`
    `void` | `setLogChannel(LogChannel logCh)`
    `boolean` | `wasCancelled()`

    - ### Methods inherited from class java.io.FileOutputStream

      `finalize, getChannel, getFD, write, write, write`

    - ### Methods inherited from class java.io.OutputStream

      `flush`

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

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

- - ### Constructor Detail

    - #### CleanupFileOutputStream

          public CleanupFileOutputStream(T task,
                                 java.io.File file)
                                  throws java.io.FileNotFoundException

      Throws:
        `java.io.FileNotFoundException`

  - ### Method Detail

    - #### setDeleteFileOnError

          public void setDeleteFileOnError(boolean isDeleteOnError)

    - #### setDeleteFileOnCancel

          public void setDeleteFileOnCancel(boolean isDeleteOnCancel)

    - #### logFileCreated

          protected void logFileCreated(java.io.File file)

    - #### logFileClosed

          protected void logFileClosed(java.io.File file)

    - #### logFileDeleted

          protected void logFileDeleted(java.io.File file)

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `java.io.FileOutputStream`
      Throws:
        `java.io.IOException`

    - #### getTask

          public T getTask()

    - #### getFile

          public java.io.File getFile()

    - #### hasError

          public boolean hasError()

    - #### wasCancelled

          public boolean wasCancelled()

    - #### getLogChannel

          public LogChannel getLogChannel()

      Specified by:
        `getLogChannel` in interface `SimpleLogSupport`

    - #### isLogDebug

          public boolean isLogDebug()

      Specified by:
        `isLogDebug` in interface `SimpleLogSupport`

    - #### isLogVerbose

          public boolean isLogVerbose()

      Specified by:
        `isLogVerbose` in interface `SimpleLogSupport`

    - #### logDebug

          public void logDebug(java.lang.String message)

      Specified by:
        `logDebug` in interface `SimpleLogSupport`

    - #### logDump

          public void logDump(java.lang.String message)

      Specified by:
        `logDump` in interface `SimpleLogSupport`

    - #### logError

          public void logError(java.lang.String message,
                      java.lang.Exception e)

      Specified by:
        `logError` in interface `SimpleLogSupport`

    - #### logError

          public void logError(java.lang.String message)

      Specified by:
        `logError` in interface `SimpleLogSupport`

    - #### logFatal

          public void logFatal(java.lang.String message,
                      java.lang.Exception e)

      Specified by:
        `logFatal` in interface `SimpleLogSupport`

    - #### logInfo

          public void logInfo(java.lang.String message)

      Specified by:
        `logInfo` in interface `SimpleLogSupport`

    - #### logVerbose

          public void logVerbose(java.lang.String message)

      Specified by:
        `logVerbose` in interface `SimpleLogSupport`

    - #### logWarning

          public void logWarning(java.lang.String message)

      Specified by:
        `logWarning` in interface `SimpleLogSupport`

    - #### setLogChannel

          public void setLogChannel(LogChannel logCh)

      Specified by:
        `setLogChannel` in interface `SimpleLogSupport`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.