Package org.pgcodekeeper.core.utils
Class UnixPrintWriter
java.lang.Object
java.io.Writer
java.io.PrintWriter
org.pgcodekeeper.core.utils.UnixPrintWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
A
PrintWriter implementation that ensures Unix-style line endings ('\n')
regardless of the platform.-
Constructor Summary
ConstructorsConstructorDescriptionUnixPrintWriter(File file) Creates a new UnixPrintWriter that writes to a file.UnixPrintWriter(File file, String csn) Creates a new UnixPrintWriter that writes to a file with specified charset.UnixPrintWriter(File file, Charset csn) Creates a new UnixPrintWriter that writes to a file with specified charset.Creates a new UnixPrintWriter from an OutputStream.UnixPrintWriter(OutputStream out, boolean autoFlush) Creates a new UnixPrintWriter from an OutputStream with optional auto-flush.UnixPrintWriter(OutputStream out, String csn) Creates a new UnixPrintWriter from an OutputStream with specified charset.UnixPrintWriter(Writer out) Creates a new UnixPrintWriter without automatic line flushing.UnixPrintWriter(Writer out, boolean autoFlush) Creates a new UnixPrintWriter with optional auto-flush.UnixPrintWriter(String fileName) Creates a new UnixPrintWriter that writes to a file.UnixPrintWriter(String fileName, String csn) Creates a new UnixPrintWriter that writes to a file with specified charset.UnixPrintWriter(String fileName, Charset csn) Creates a new UnixPrintWriter that writes to a file with specified charset. -
Method Summary
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, write, write, write, write, writeMethods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
UnixPrintWriter
Creates a new UnixPrintWriter without automatic line flushing.- Parameters:
out- the underlying writer
-
UnixPrintWriter
Creates a new UnixPrintWriter from an OutputStream.- Parameters:
out- the underlying output stream
-
UnixPrintWriter
Creates a new UnixPrintWriter that writes to a file.- Parameters:
fileName- path to the output file- Throws:
FileNotFoundException- if the file cannot be opened
-
UnixPrintWriter
Creates a new UnixPrintWriter that writes to a file.- Parameters:
file- the output file- Throws:
FileNotFoundException- if the file cannot be opened
-
UnixPrintWriter
Creates a new UnixPrintWriter with optional auto-flush.- Parameters:
out- the underlying writerautoFlush- if true, flushes after every println call
-
UnixPrintWriter
Creates a new UnixPrintWriter from an OutputStream with optional auto-flush.- Parameters:
out- the underlying output streamautoFlush- if true, flushes after every println call
-
UnixPrintWriter
public UnixPrintWriter(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException Creates a new UnixPrintWriter that writes to a file with specified charset.- Parameters:
fileName- path to the output filecsn- charset name for encoding- Throws:
FileNotFoundException- if the file cannot be openedUnsupportedEncodingException- if the charset is not supported
-
UnixPrintWriter
public UnixPrintWriter(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException Creates a new UnixPrintWriter that writes to a file with specified charset.- Parameters:
file- the output filecsn- charset name for encoding- Throws:
FileNotFoundException- if the file cannot be openedUnsupportedEncodingException- if the charset is not supported
-
UnixPrintWriter
Creates a new UnixPrintWriter from an OutputStream with specified charset.- Parameters:
out- the underlying output streamcsn- charset name for encoding- Throws:
UnsupportedEncodingException- if the charset is not supported
-
UnixPrintWriter
Creates a new UnixPrintWriter that writes to a file with specified charset.- Parameters:
fileName- path to the output filecsn- charset for encoding- Throws:
FileNotFoundException- if the file cannot be opened
-
UnixPrintWriter
Creates a new UnixPrintWriter that writes to a file with specified charset.- Parameters:
file- the output filecsn- charset for encoding- Throws:
FileNotFoundException- if the file cannot be opened
-
-
Method Details
-
println
public void println()
This version always terminates with '\n'.- Overrides:
printlnin classPrintWriter
-