|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| 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 as default stream. |
| Method Summary | |
|---|---|
void |
close()
Closes the SafeOutputStream by closing the OutputStream
this stream was constructed of. |
boolean |
doesNothing()
Indicates whether the instance is doing something or not. |
protected void |
finalize()
|
void |
flush()
|
OutputStream |
getOutputStream()
Returns the internal used OutputStream. |
static SafeOutputStream |
getSafeOutputStream(OutputStream out)
This method returns an instance of SafeOutputStream for a given OutputStream. |
void |
write(int b)
|
void |
write(Object s)
Writes an Object using Object.toString(). |
void |
writeln()
Writes a line break. |
void |
writeln(Object s)
Writes an Object and a line break. |
| 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
| Method Detail |
|---|
public static SafeOutputStream getSafeOutputStream(OutputStream out)
SafeOutputStream for a given OutputStream.
out - the OutputStream
SafeOutputStream for a given OutputStream.public void close()
throws IOException
SafeOutputStream by closing the OutputStream
this stream was constructed of. If this SafeOutputStream was
constructed using System.out this OutputStream will
be closed. No outputs via System.out will be possible any
more.
close in interface Closeableclose in class OutputStreamIOException - if something went wrong in closing the output streampublic boolean doesNothing()
true if the internal OutputStream is
nullpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic OutputStream getOutputStream()
OutputStream.
OutputStreampublic void writeln()
throws IOException
IOException - if something went wrongwrite(int)public void writeln(Object s)
throws IOException
Object and a line break.
s - the Object to be written
IOException - if something went wrongwrite(int),
Object.toString()public void write(Object s)
throws IOException
Object using Object.toString().
s - the Object to be written
IOException - if something went wrongwrite(int)public void write(int b)
throws IOException
write in class OutputStreamIOExceptionprotected void finalize()
throws IOException
finalize in class ObjectIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||