Class BetterFileOutputStream

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

    public final class BetterFileOutputStream
    extends java.io.FileOutputStream
    Whenever you need a FileOutputStream and want a better toString implementation you can use the class BetterFileOutputStream. "Better" means that you see the name if the input file in the log which is much more helpful than the default implementation of Object.toString(), especially for logging and debugging.
    Since:
    1.3.1 (14.09.2013)
    Author:
    oliver (boehm@javatux.de)
    See Also:
    FileOutputStream
    • Constructor Summary

      Constructors 
      Constructor Description
      BetterFileOutputStream​(java.io.File file)
      Instantiates a new better file output stream.
      BetterFileOutputStream​(java.io.File file, boolean append)
      Instantiates a new better file output stream.
      BetterFileOutputStream​(java.lang.String name)
      Instantiates a new better file output stream.
      BetterFileOutputStream​(java.lang.String name, boolean append)
      Instantiates a new better file output stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()
      This toString implementation reports the name of the output file which is much more helpful than the default implementation of Object.toString(), especially for logging and debugging.
      • Methods inherited from class java.io.FileOutputStream

        close, finalize, getChannel, getFD, write, write, write
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream
      • Methods inherited from class java.lang.Object

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

      • BetterFileOutputStream

        public BetterFileOutputStream​(java.lang.String name)
                               throws java.io.FileNotFoundException
        Instantiates a new better file output stream.
        Parameters:
        name - the file name
        Throws:
        java.io.FileNotFoundException - the file not found exception
        See Also:
        FileOutputStream(String)
      • BetterFileOutputStream

        public BetterFileOutputStream​(java.io.File file)
                               throws java.io.FileNotFoundException
        Instantiates a new better file output stream.
        Parameters:
        file - the file
        Throws:
        java.io.FileNotFoundException - the file not found exception
        See Also:
        FileOutputStream(File)
      • BetterFileOutputStream

        public BetterFileOutputStream​(java.lang.String name,
                                      boolean append)
                               throws java.io.FileNotFoundException
        Instantiates a new better file output stream.
        Parameters:
        name - the file name
        append - if it should be appended
        Throws:
        java.io.FileNotFoundException - the file not found exception
        See Also:
        FileOutputStream(String,boolean)
      • BetterFileOutputStream

        public BetterFileOutputStream​(java.io.File file,
                                      boolean append)
                               throws java.io.FileNotFoundException
        Instantiates a new better file output stream.
        Parameters:
        file - the file
        append - if it should be appended
        Throws:
        java.io.FileNotFoundException - the file not found exception
        See Also:
        FileOutputStream(File,boolean)
    • Method Detail

      • toString

        public java.lang.String toString()
        This toString implementation reports the name of the output file which is much more helpful than the default implementation of Object.toString(), especially for logging and debugging.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string
        See Also:
        Object.toString()