Package jade.util
Class PrintStreamSplitter
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- jade.util.PrintStreamSplitter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class PrintStreamSplitter extends PrintStream
This class is an OutputStream whose output is duplicated and forwarded to two different output streams.- Author:
- Giovanni Caire - TILab
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description PrintStreamSplitter(PrintStream s1, PrintStream s2)Create a new stream that feeds the output to the two given streams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprint(Object obj)Print a Java object to the two streams.voidprint(String str)Print a string to the two streams.voidprintln()Print a new line to the two streams.voidprintln(Object obj)Print a Java object and a new line to the two streams.voidprintln(String str)Print a string and a new line to the two streams.-
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, setError, write, write
-
Methods inherited from class java.io.FilterOutputStream
write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
PrintStreamSplitter
public PrintStreamSplitter(PrintStream s1, PrintStream s2) throws IOException
Create a new stream that feeds the output to the two given streams.- Parameters:
s1- The first stream to write to.s2- The second stream to write to.- Throws:
IOException- If some stream operation fails.
-
-
Method Detail
-
print
public void print(Object obj)
Print a Java object to the two streams.- Overrides:
printin classPrintStream- Parameters:
obj- The Java object to print.
-
print
public void print(String str)
Print a string to the two streams.- Overrides:
printin classPrintStream- Parameters:
str- The string to print.
-
println
public void println()
Print a new line to the two streams.- Overrides:
printlnin classPrintStream
-
println
public void println(Object obj)
Print a Java object and a new line to the two streams.- Overrides:
printlnin classPrintStream- Parameters:
obj- The Java object to print.
-
println
public void println(String str)
Print a string and a new line to the two streams.- Overrides:
printlnin classPrintStream- Parameters:
str- The string to print.
-
-