|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
de.jstacs.utils.SafeOutputStream
public class SafeOutputStream
This class is for any output. For example:
new SafeOutputStream( null )
).
new SafeOutputStream( System.out )
).
new SafeOutputStream( new FileOutputStream( ... ) )
).
finalize
method.
Field Summary | |
---|---|
static OutputStream |
DEFAULT_STREAM
This stream can be used to as default stream. |
Constructor Summary | |
---|---|
SafeOutputStream(OutputStream ostream)
Creates a new SafeOutputstream |
Method Summary | |
---|---|
void |
close()
Closes this SafeOutputStream by closing the OutputStream
this stream was constructed of. |
boolean |
doesNothing()
Indicates whether the instance is doing something or not. |
protected void |
finalize()
This method does not close the internal stream. |
void |
flush()
|
OutputStream |
getOutputStream()
Returns the internal used OutputStream. |
void |
write(int b)
|
void |
write(String s)
Writes the String. |
void |
writeln()
Writes a linebreak. |
void |
writeln(String s)
Writes the String and a linebreak. |
Methods inherited from class java.io.OutputStream |
---|
write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final OutputStream DEFAULT_STREAM
Constructor Detail |
---|
public SafeOutputStream(OutputStream ostream)
ostream
- the internal used OutputStreamMethod Detail |
---|
public void close() throws IOException
SafeOutputStream
by closing the OutputStream
this stream was constructed of.
If this SaveOutputStream was constructed using System.out
this
OutputStream
will be closed. No outputs via System.out
will be possible any more.
close
in interface Closeable
close
in class OutputStream
IOException
public boolean doesNothing()
true if the internal OutputStream is null
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public OutputStream getOutputStream()
public void writeln() throws IOException
IOException
- if something is wrong.write(int)
public void writeln(String s) throws IOException
s
- the String
IOException
- if something is wrong.write(int)
public void write(String s) throws IOException
s
- the String
IOException
- if something is wrong.write(int)
public void write(int b) throws IOException
write
in class OutputStream
IOException
protected void finalize() throws IOException
finalize
in class Object
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |