|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
de.schlichtherle.io.util.SynchronizedOutputStream
public class SynchronizedOutputStream
A decorator which synchronizes all access to an OutputStream
via an object provided to its constructor.
| Field Summary | |
|---|---|
protected Object |
lock
The object to synchronize on - never null. |
protected OutputStream |
out
The decorated output stream. |
| Constructor Summary | |
|---|---|
SynchronizedOutputStream(OutputStream out)
Constructs a new synchronized output stream. |
|
SynchronizedOutputStream(OutputStream out,
Object lock)
Constructs a new synchronized output stream. |
|
| Method Summary | |
|---|---|
void |
close()
Synchronizes on the lock and calls doClose(). |
protected void |
doClose()
Calls doFlush() and finally closes the underlying stream. |
protected void |
doFlush()
Flushes the underlying stream. |
void |
flush()
Synchronizes on the lock and calls doFlush(). |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Object lock
null.
protected OutputStream out
| Constructor Detail |
|---|
public SynchronizedOutputStream(OutputStream out)
out - The output stream to wrap in this decorator.
public SynchronizedOutputStream(OutputStream out,
Object lock)
out - The output stream to wrap in this decorator.lock - The object to synchronize on.
If null, then this object is used, not the stream.| Method Detail |
|---|
public void write(int b)
throws IOException
write in class OutputStreamIOException
public void write(byte[] b)
throws IOException
write in class OutputStreamIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOException
public void flush()
throws IOException
lock and calls doFlush().
flush in interface Flushableflush in class OutputStreamIOException
protected void doFlush()
throws IOException
IOException
public void close()
throws IOException
lock and calls doClose().
close in interface Closeableclose in class OutputStreamIOException
protected void doClose()
throws IOException
doFlush() and finally closes the underlying stream.
This method is not synchronized!
IOException
|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||