Package weka.core.logging
Class OutputLogger.OutputPrintStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
weka.core.logging.OutputLogger.OutputPrintStream
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
- Enclosing class:
- OutputLogger
A print stream class to capture all data from stdout and stderr.
- Version:
- $Revision: 15092 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
Constructor Summary
ConstructorDescriptionOutputPrintStream
(OutputLogger owner, PrintStream stream) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionappend
(char c) Appends the specified character to this output stream.append
(CharSequence csq) Appends the specified character sequence to this output stream.append
(CharSequence csq, int start, int end) Appends a subsequence of the specified character sequence to this output stream.void
flush()
ignored.void
print
(boolean x) prints the given boolean to the streams.void
print
(int x) prints the given int to the streams.void
prints the given object to the streams.void
prints the given string to the streams.void
println()
prints a new line to the streams.void
println
(boolean x) prints the given boolean to the streams.void
println
(int x) prints the given int to the streams.void
prints the given object to the streams (for Throwables we print the stack trace).void
prints the given string to the streams.void
write
(byte[] b) Writes the bytes to the stream.void
write
(byte[] buf, int off, int len) Writes the bytes to the stream.void
write
(int b) Writes the byte to the stream.Methods inherited from class java.io.PrintStream
checkError, close, format, format, print, print, print, print, print, printf, printf, println, println, println, println, println, writeBytes
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
OutputPrintStream
Default constructor.- Parameters:
owner
- the owning loggerstream
- the stream- Throws:
Exception
- if something goes wrong
-
-
Method Details
-
flush
public void flush()ignored.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classPrintStream
-
print
public void print(int x) prints the given int to the streams.- Overrides:
print
in classPrintStream
- Parameters:
x
- the object to print
-
print
public void print(boolean x) prints the given boolean to the streams.- Overrides:
print
in classPrintStream
- Parameters:
x
- the object to print
-
print
prints the given string to the streams.- Overrides:
print
in classPrintStream
- Parameters:
x
- the object to print
-
print
prints the given object to the streams.- Overrides:
print
in classPrintStream
- Parameters:
x
- the object to print
-
println
public void println()prints a new line to the streams.- Overrides:
println
in classPrintStream
-
println
public void println(int x) prints the given int to the streams.- Overrides:
println
in classPrintStream
- Parameters:
x
- the object to print
-
println
public void println(boolean x) prints the given boolean to the streams.- Overrides:
println
in classPrintStream
- Parameters:
x
- the object to print
-
println
prints the given string to the streams.- Overrides:
println
in classPrintStream
- Parameters:
x
- the object to print
-
println
prints the given object to the streams (for Throwables we print the stack trace).- Overrides:
println
in classPrintStream
- Parameters:
x
- the object to print
-
write
public void write(int b) Writes the byte to the stream.- Overrides:
write
in classPrintStream
- Parameters:
b
- the byte to write
-
write
Writes the bytes to the stream.- Overrides:
write
in classPrintStream
- Parameters:
b
- the bytes to write- Throws:
IOException
-
write
public void write(byte[] buf, int off, int len) Writes the bytes to the stream.- Overrides:
write
in classPrintStream
- Parameters:
buf
- the buffer to useoff
- the offsetlen
- the number of bytes to write
-
append
Appends a subsequence of the specified character sequence to this output stream.An invocation of this method of the form
out.append(csq, start, end)
whencsq
is notnull
, behaves in exactly the same way as the invocationout.print(csq.subSequence(start, end).toString())
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classPrintStream
- Parameters:
csq
- The character sequence from which a subsequence will be appended. Ifcsq
isnull
, then characters will be appended as ifcsq
contained the four characters"null"
.start
- The index of the first character in the subsequenceend
- The index of the character following the last character in the subsequence- Returns:
- This output stream
- Throws:
IndexOutOfBoundsException
- Ifstart
orend
are negative,start
is greater thanend
, orend
is greater thancsq.length()
- Since:
- 1.5
-
append
Appends the specified character sequence to this output stream.An invocation of this method of the form
out.append(csq)
behaves in exactly the same way as the invocationout.print(csq.toString())
Depending on the specification of
toString
for the character sequencecsq
, the entire sequence may not be appended. For instance, invoking thentoString
method of a character buffer will return a subsequence whose content depends upon the buffer's position and limit.- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classPrintStream
- Parameters:
csq
- The character sequence to append. Ifcsq
isnull
, then the four characters"null"
are appended to this output stream.- Returns:
- This output stream
- Since:
- 1.5
-
append
Appends the specified character to this output stream.An invocation of this method of the form
out.append(c)
behaves in exactly the same way as the invocationout.print(c)
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classPrintStream
- Parameters:
c
- The 16-bit character to append- Returns:
- This output stream
- Since:
- 1.5
-