Package view.output

Class AFileWriter

java.lang.Object
view.output.AFileWriter
Direct Known Subclasses:
FileWriterWrapper

public abstract class AFileWriter
extends java.lang.Object
Abstract class AFileWriter member of class adapter pattern (Target). (Does not extend FileWriter to prevent the need of handling possible thrown exceptions outside of Target.) Offers the possibility to map functionality to FileWriter. FileWriter Adaptee
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.io.FileWriter fileWriter  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected AFileWriter​(java.io.File file)
    Implemented constructor of AFileWriter which takes a file and handles possible IOExceptions.
  • Method Summary

    Modifier and Type Method Description
    abstract void close()
    Close function for closing a file.
    abstract void write​(java.lang.String content)
    Write function for writing to a file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fileWriter

      protected java.io.FileWriter fileWriter
  • Constructor Details

    • AFileWriter

      protected AFileWriter​(java.io.File file)
      Implemented constructor of AFileWriter which takes a file and handles possible IOExceptions.
      Parameters:
      file - to be written to.
  • Method Details

    • write

      public abstract void write​(java.lang.String content)
      Write function for writing to a file. Exceptions are handled and the buffer gets flushed after every call to ensure the file to be written to even if it is not closed properly.
      Parameters:
      content -
    • close

      public abstract void close()
      Close function for closing a file. Exceptions are handled.