Package com.molecular_java
Class MyWriter
java.lang.Object
com.molecular_java.MyWriter
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 Summary
ConstructorsConstructorDescriptionMyWriter(BufferedWriter bufWrite) Constructor which takes aBufferedWriterand uses it as an attribute. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closesbuffy.voidPrints all lines of the given file to thebuffy.voidWrites given String as a line to abuffy.
-
Constructor Details
-
MyWriter
Constructor which takes aBufferedWriterand uses it as an attribute.- Parameters:
bufWrite- buffered writer used as an attribute
-
-
Method Details
-
writeLine
Writes given String as a line to abuffy.- Parameters:
str- string to write- Throws:
IOException- if an I/O Error occurs
-
writeAll
Prints all lines of the given file to thebuffy.- Parameters:
in- given input file- Throws:
IOException- if an I/O Error occurs
-
close
Closesbuffy.- Throws:
IOException- if an I/O Error occurs
-