public class PrintWriterUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closePrintWriter(java.io.File file,
java.io.PrintWriter printWriter)
Closes the given print writer, or flushes it if is the standard output.
|
static java.io.PrintWriter |
createPrintWriter(java.io.File outputFile,
java.io.PrintWriter console)
Returns a print writer for the given file, or the standard output if
the file name is empty.
|
static java.io.PrintWriter |
createPrintWriter(java.io.File outputFile,
java.io.PrintWriter console,
boolean append)
Returns a print writer for the given file, or the standard output if
the file name is empty.
|
static java.io.PrintWriter |
createPrintWriterErr(java.io.File outputFile)
Returns a print writer for the given file, or the standard output if
the file name is empty.
|
static java.io.PrintWriter |
createPrintWriterOut(java.io.File outputFile)
Returns a print writer for the given file, or the standard output if
the file name is empty.
|
static java.io.PrintWriter |
createPrintWriterOut(java.io.File outputFile,
boolean append)
Returns a print writer for the given file, or the standard output if
the file name is empty.
|
static java.lang.String |
fileName(java.io.File file)
Returns the canonical file name for the given file, or "standard output"
if the file name is empty.
|
public static java.io.PrintWriter createPrintWriterOut(java.io.File outputFile)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic static java.io.PrintWriter createPrintWriterOut(java.io.File outputFile,
boolean append)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic static java.io.PrintWriter createPrintWriterErr(java.io.File outputFile)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic static java.io.PrintWriter createPrintWriter(java.io.File outputFile,
java.io.PrintWriter console)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic static java.io.PrintWriter createPrintWriter(java.io.File outputFile,
java.io.PrintWriter console,
boolean append)
throws java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingExceptionpublic static void closePrintWriter(java.io.File file,
java.io.PrintWriter printWriter)
public static java.lang.String fileName(java.io.File file)