Class CountingFileOutputStream

java.lang.Object
java.io.OutputStream
java.io.FileOutputStream
com.helger.io.stream.CountingFileOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class CountingFileOutputStream extends FileOutputStream
A special FileOutputStream sub class that keeps track of all written bytes for the statistics handler.
Author:
Philip Helger
  • Field Details

    • DEFAULT_APPEND

      public static final com.helger.base.io.EAppend DEFAULT_APPEND
      By default append is enabled
  • Constructor Details

    • CountingFileOutputStream

      public CountingFileOutputStream(@NonNull File aFile) throws FileNotFoundException
      Constructor using the default append mode.
      Parameters:
      aFile - The file to write to. May not be null.
      Throws:
      FileNotFoundException - If the file cannot be opened for writing.
    • CountingFileOutputStream

      public CountingFileOutputStream(@NonNull File aFile, @NonNull com.helger.base.io.EAppend eAppend) throws FileNotFoundException
      Constructor with explicit append mode.
      Parameters:
      aFile - The file to write to. May not be null.
      eAppend - Appending mode. May not be null.
      Throws:
      FileNotFoundException - If the file cannot be opened for writing.
    • CountingFileOutputStream

      public CountingFileOutputStream(@NonNull String sFilename) throws FileNotFoundException
      Constructor using the default append mode.
      Parameters:
      sFilename - The filename to write to. May not be null.
      Throws:
      FileNotFoundException - If the file cannot be opened for writing.
    • CountingFileOutputStream

      public CountingFileOutputStream(@NonNull String sFilename, @NonNull com.helger.base.io.EAppend eAppend) throws FileNotFoundException
      Constructor with explicit append mode.
      Parameters:
      sFilename - The filename to write to. May not be null.
      eAppend - Appending mode. May not be null.
      Throws:
      FileNotFoundException - If the file cannot be opened for writing.
  • Method Details