Package com.compomics.util.io.flat
Class SimpleFileWriter
java.lang.Object
com.compomics.util.io.flat.SimpleFileWriter
- All Implemented Interfaces:
AutoCloseable
Simple gz file writer that is thread safe and throws exceptions as runtime
exceptions.
- Author:
- Marc Vaudel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the underlying buffered writer.voidnewLine()Appends a new line to the output.voidwrite(char[] buffer, int offset, int length) Writes a a buffer of characters to the file.voidWrites text.voidWrites text.voidWrites a new line.voidWrites a new line using the give elements.
-
Constructor Details
-
SimpleFileWriter
Constructor.- Parameters:
file- The file to write to.gz- Boolean indicating whether the output should be gzipped.
-
-
Method Details
-
writeLine
Writes a new line using the give elements. Elements are separated using the separator in the properties class.- Parameters:
elements- The line elements to write.
-
writeLine
Writes a new line.- Parameters:
line- The line to write.
-
write
public void write(char[] buffer, int offset, int length) Writes a a buffer of characters to the file.- Parameters:
buffer- The buffer to write.offset- The offset from which to start reading characters.length- The maximal number of characters to write
-
newLine
public void newLine()Appends a new line to the output. -
write
Writes text.- Parameters:
text- The text to write.
-
write
Writes text.- Parameters:
text- The text to write.newLine- Boolean indicating whether an end of line should be appended.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getWriter
Returns the underlying buffered writer.- Returns:
- The underlying buffered writer.
-