Class MyWriter

java.lang.Object
com.molecular_java.MyWriter

public class MyWriter extends Object
This class is used to write to files instead of standard BufferedWriter. The BufferedWriter has not so neat methods. It contains a constructor which gets the initialized BufferedWriter and loads it as an attribute of this class. Then it has a writeLine(String) and a writeAll(BufferedReader) methods which easily write to the loaded buffered writer.
  • Constructor Details

    • MyWriter

      public MyWriter(BufferedWriter bufWrite)
      Constructor which takes a BufferedWriter and uses it as an attribute.
      Parameters:
      bufWrite - buffered writer used as an attribute
  • Method Details

    • writeLine

      public void writeLine(String str) throws IOException
      Writes given String as a line to a buffy.
      Parameters:
      str - string to write
      Throws:
      IOException - if an I/O Error occurs
    • writeAll

      public void writeAll(BufferedReader in) throws IOException
      Prints all lines of the given file to the buffy.
      Parameters:
      in - given input file
      Throws:
      IOException - if an I/O Error occurs
    • close

      public void close() throws IOException
      Closes buffy.
      Throws:
      IOException - if an I/O Error occurs