Class NullPrintStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- de.christofreichardt.diagnosis.io.IndentablePrintStream
-
- de.christofreichardt.diagnosis.io.NullPrintStream
-
- All Implemented Interfaces:
Indentable,Closeable,Flushable,Appendable,AutoCloseable
public final class NullPrintStream extends IndentablePrintStream
The tracer classes return such a NullPrintStream when the current state and the configuration demands that no output should be written. This is equivalent to a redirection to /dev/null.- Author:
- Christof Reichardt
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description NullPrintStream()Default constructor passes aNullOutputStreamto the underlyingIndentablePrintStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndentablePrintStreamappend(char c)Pseudo append()-method.IndentablePrintStreamappend(CharSequence csq)Pseudo append()-method.IndentablePrintStreamappend(CharSequence csq, int start, int end)Pseudo append()-method.booleancheckError()Indicates always no error.protected voidclearError()Pseudo clearError()-method.voidclose()Closes the underlying IndentablePrintStream.voidflush()Pseudo flush()-method.IndentablePrintStreamformat(String format, Object... args)Pseudo format()-method.IndentablePrintStreamformat(Locale l, String format, Object... args)Pseudo format()-method.voidlock()Pseudo lock()-method.voidprint(boolean b)Pseudo print()-method.voidprint(char c)Pseudo print()-method.voidprint(char[] s)Pseudo print()-method.voidprint(double d)Pseudo print()-method.voidprint(float f)Pseudo print()-method.voidprint(int i)Pseudo print()-method.voidprint(long l)Pseudo print()-method.voidprint(Object obj)Pseudo print()-method.voidprint(String s)Pseudo print()-method.IndentablePrintStreamprintf(String format, Object... args)Pseudo printf()-method.IndentablePrintStreamprintf(Locale l, String format, Object... args)Pseudo printf()-method.IndentablePrintStreamprintfIndentln(String format, Object... args)A convenience method to print an indented string onto the stream using the specified format string and the given arguments.IndentablePrintStreamprintIndent(String s)Prints an indented string.IndentablePrintStreamprintIndentln(String s)Prints an indented string together with a line feed.IndentablePrintStreamprintIndentString()Prints only the current indentation.voidprintln()Pseudo println()-method.voidprintln(boolean x)Pseudo println()-method.voidprintln(char x)Pseudo println()-method.voidprintln(char[] x)Pseudo println()-method.voidprintln(double x)Pseudo println()-method.voidprintln(float x)Pseudo println()-method.voidprintln(int x)Pseudo println()-method.voidprintln(long x)Pseudo println()-method.voidprintln(Object x)Pseudo println()-method.voidprintln(String x)Pseudo println()-method.voidrunWithLock(Runnable runnable)Pseudo runWithLock()-method.protected voidsetError()Pseudo setError()-method.voidunlock()Pseudo unlock()-methodvoidwrite(byte[] b)Pseudo write()-method.voidwrite(byte[] buf, int off, int len)Pseudo write()-method.voidwrite(int b)Pseudo write()-method.-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
NullPrintStream
public NullPrintStream()
Default constructor passes aNullOutputStreamto the underlyingIndentablePrintStream.
-
-
Method Detail
-
printIndent
public IndentablePrintStream printIndent(String s)
Description copied from interface:IndentablePrints an indented string.- Specified by:
printIndentin interfaceIndentable- Specified by:
printIndentin classIndentablePrintStream- Parameters:
s- the string to be printed- Returns:
- the indentable stream itself
-
printIndentln
public IndentablePrintStream printIndentln(String s)
Description copied from interface:IndentablePrints an indented string together with a line feed.- Specified by:
printIndentlnin interfaceIndentable- Specified by:
printIndentlnin classIndentablePrintStream- Parameters:
s- the string to be printed- Returns:
- the indentable stream itself
-
printIndentString
public IndentablePrintStream printIndentString()
Description copied from interface:IndentablePrints only the current indentation.- Specified by:
printIndentStringin interfaceIndentable- Specified by:
printIndentStringin classIndentablePrintStream- Returns:
- the indentable stream itself
-
printfIndentln
public IndentablePrintStream printfIndentln(String format, Object... args)
Description copied from interface:IndentableA convenience method to print an indented string onto the stream using the specified format string and the given arguments.- Specified by:
printfIndentlnin interfaceIndentable- Specified by:
printfIndentlnin classIndentablePrintStream- Parameters:
format- the format stringargs- the to be printed arguments- Returns:
- the indentable stream itself
-
lock
public void lock()
Pseudo lock()-method.- Specified by:
lockin classIndentablePrintStream
-
unlock
public void unlock()
Pseudo unlock()-method- Specified by:
unlockin classIndentablePrintStream
-
runWithLock
public void runWithLock(Runnable runnable)
Pseudo runWithLock()-method.- Specified by:
runWithLockin classIndentablePrintStream- Parameters:
runnable- should contain print statements
-
append
public IndentablePrintStream append(CharSequence csq)
Pseudo append()-method.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classPrintStream- Parameters:
csq- won't be evaluated- Returns:
- this indentable print stream
-
append
public IndentablePrintStream append(CharSequence csq, int start, int end)
Pseudo append()-method.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classPrintStream- Parameters:
csq- won't be evaluatedstart- won't be evaluatedend- won't be evaluated- Returns:
- this indentable print stream
-
append
public IndentablePrintStream append(char c)
Pseudo append()-method.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classPrintStream- Parameters:
c- won't be evaluated- Returns:
- this indentable print stream
-
clearError
protected void clearError()
Pseudo clearError()-method.- Overrides:
clearErrorin classPrintStream
-
checkError
public boolean checkError()
Indicates always no error.- Overrides:
checkErrorin classPrintStream- Returns:
- always false
-
format
public IndentablePrintStream format(Locale l, String format, Object... args)
Pseudo format()-method.- Overrides:
formatin classPrintStream- Parameters:
l- won't be evaluatedformat- won't be evaluatedargs- won't be evaluated- Returns:
- this indentable print stream
-
format
public IndentablePrintStream format(String format, Object... args)
Pseudo format()-method.- Overrides:
formatin classPrintStream- Parameters:
format- won't be evaluatedargs- won't be evaluated- Returns:
- this indentable print stream
-
print
public void print(char[] s)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
s- won't be evaluated
-
print
public void print(Object obj)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
obj- won't be evaluated
-
print
public void print(char c)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
c- won't be evaluated
-
print
public void print(int i)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
i- won't be evaluated
-
print
public void print(String s)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
s- won't be evaluated
-
print
public void print(boolean b)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
b- won't be evaluated
-
print
public void print(long l)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
l- won't be evaluated
-
print
public void print(double d)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
d- won't be evaluated
-
print
public void print(float f)
Pseudo print()-method.- Overrides:
printin classPrintStream- Parameters:
f- won't be evaluated
-
printf
public IndentablePrintStream printf(Locale l, String format, Object... args)
Pseudo printf()-method.- Overrides:
printfin classPrintStream- Parameters:
l- won't be evaluatedformat- won't be evaluatedargs- won't be evaluated- Returns:
- this indentable print stream
-
printf
public IndentablePrintStream printf(String format, Object... args)
Pseudo printf()-method.- Overrides:
printfin classPrintStream- Parameters:
format- won't be evaluatedargs- won't be evaluated- Returns:
- this indentable print stream
-
println
public void println(char[] x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println()
Pseudo println()-method.- Overrides:
printlnin classPrintStream
-
println
public void println(Object x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(char x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(int x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(String x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(boolean x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(long x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(double x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
println
public void println(float x)
Pseudo println()-method.- Overrides:
printlnin classPrintStream- Parameters:
x- won't be evaluated
-
setError
protected void setError()
Pseudo setError()-method.- Overrides:
setErrorin classPrintStream
-
write
public void write(int b)
Pseudo write()-method.- Overrides:
writein classPrintStream- Parameters:
b- won't be evaluated
-
write
public void write(byte[] buf, int off, int len)Pseudo write()-method.- Overrides:
writein classPrintStream- Parameters:
buf- won't be evaluatedoff- won't be evaluatedlen- won't be evaluated
-
write
public void write(byte[] b)
Pseudo write()-method.- Overrides:
writein classFilterOutputStream- Parameters:
b- won't be evaluated
-
flush
public void flush()
Pseudo flush()-method.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classPrintStream
-
close
public void close()
Closes the underlying IndentablePrintStream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPrintStream
-
-