Java Reference
In-Depth Information
/** The filename we are tee-ing too, if known;
* intended for use in future error reporting.
*/
protected
protected
String fileName
;
/** The name for when the input filename is not known */
private
private static
static final
final
String UNKNOWN_NAME
=
"(opened Stream)"
;
/** Construct a TeePrintStream given an existing PrintStream,
* an opened OutputStream, and a boolean to control auto-flush.
* This is the main constructor, to which others delegate via "this".
*/
public
public
TeePrintStream
(
PrintStream orig
,
OutputStream os
,
boolean
boolean
flush
)
throws
throws
IOException
{
super
super
(
os
,
true
true
);
fileName
=
UNKNOWN_NAME
;
parent
=
orig
;
}
/** Construct a TeePrintStream given an existing PrintStream and
* an opened OutputStream.
*/
public
public
TeePrintStream
(
PrintStream orig
,
OutputStream os
)
throws
throws
IOException
{
this
this
(
orig
,
os
,
true
true
);
}
/* Construct a TeePrintStream given an existing Stream and a filename.
*/
public
public
TeePrintStream
(
PrintStream os
,
String fn
)
throws
throws
IOException
{
this
this
(
os
,
fn
,
true
true
);
}
/* Construct a TeePrintStream given an existing Stream, a filename,
* and a boolean to control the flush operation.
*/
public
public
TeePrintStream
(
PrintStream orig
,
String fn
,
boolean
boolean
flush
)
throws
throws
IOException
{
this
this
(
orig
,
new
new
FileOutputStream
(
fn
),
flush
);
fileName
=
fn
;
}
/** Return true if either stream has an error. */
public
public
boolean
boolean
checkError
() {
return
return
parent
.
checkError
() ||
super
super
.
checkError
();