public class SimpleFileWriter extends Object implements AutoCloseable
Constructor and Description |
---|
SimpleFileWriter(File file,
boolean gz)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
BufferedWriter |
getWriter()
Returns the underlying buffered writer.
|
void |
newLine()
Appends a new line to the output.
|
void |
write(char[] buffer,
int offset,
int length)
Writes a a buffer of characters to the file.
|
void |
write(String text)
Writes text.
|
void |
write(String text,
boolean newLine)
Writes text.
|
void |
writeLine(String... elements)
Writes a new line using the give elements.
|
void |
writeLine(String line)
Writes a new line.
|
public SimpleFileWriter(File file, boolean gz)
file
- The file to write to.gz
- Boolean indicating whether the output should be gzipped.public void writeLine(String... elements)
elements
- The line elements to write.public void writeLine(String line)
line
- The line to write.public void write(char[] buffer, int offset, int length)
buffer
- The buffer to write.offset
- The offset from which to start reading characters.length
- The maximal number of characters to writepublic void newLine()
public void write(String text)
text
- The text to write.public void write(String text, boolean newLine)
text
- The text to write.newLine
- Boolean indicating whether an end of line should be
appended.public void close()
close
in interface AutoCloseable
public BufferedWriter getWriter()
Copyright © 2021. All rights reserved.