Java Reference
In-Depth Information
}
/** override write(). This is the actual "tee" operation. */
public
public void
int x ) {
parent . write ( x );
void write ( int
// "write once;
super
super . write ( x );
// write somewhere else."
}
/** override write(). This is the actual "tee" operation. */
public
public void
void write ( byte
byte [] x , int
int o , int
int l ) {
parent . write ( x , o , l );
// "write once;
super
super . write ( x , o , l );
// write somewhere else."
}
/** Close both streams. */
public
public void
void close () {
parent . close ();
super
super . close ();
}
/** Flush both streams. */
public
public void
void flush () {
parent . flush ();
super
super . flush ();
}
}
It's worth mentioning that I do not need to override all the polymorphic forms of print()
and println() . Because these all ultimately use one of the forms of write() , if you over-
ride the print and println methods to do the tee -ing as well, you can get several additional
copies of the data written out.
Reading/Writing a Different Character Set
Problem
You need to read or write a text file using a particular encoding.
Search WWH ::




Custom Search