Java Reference
In-Depth Information
Creates a new
PrintWriter
that will write to the stream
out
.
If
autoflush
is
true
,
println
invokes
flush
. Otherwise,
println
invocations are treated like any other method, and
flush
is
not invoked. Autoflush behavior cannot be changed after the
stream is constructed.
public
PrintWriter(Writer out)
Equivalent to
PrintWriter(out,false)
.
public
PrintWriter(OutputStream out, boolean autoflush)
Equivalent to
PrintWriter(new OutputStreamWriter(out), auto-
flush).
public
PrintWriter(OutputStream out)
Equivalent to
PrintWriter(newOutputStreamWriter(out), false)
.
public
PrintWriter(File file)
throws FileNotFoundException
Equivalent to
PrintWriter(newOutputStreamWriter(fos))
, where
fos
is a
FileOutputStream
created with the given file.
public
PrintWriter(File file, String enc)
tHRows FileNotFoundExcep-
tion, UnsupportedEncodingException
Equivalent to
PrintWriter(newOutputStreamWriter(fos, enc))
,
where
fos
is a
FileOutputStream
created with the given file.
public
PrintWriter(String filename)
throws FileNotFoundException
Equivalent to
PrintWriter(newOutputStreamWriter(fos))
, where
fos
is a
FileOutputStream
created with the given file name.