de.schlichtherle.truezip.io
Class SynchronizedOutputStream
java.lang.Object
java.io.OutputStream
de.schlichtherle.truezip.io.DecoratingOutputStream
de.schlichtherle.truezip.io.SynchronizedOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- Direct Known Subclasses:
- ConcurrentOutputShop.SynchronizedConcurrentOutputStream
public class SynchronizedOutputStream
- extends DecoratingOutputStream
A decorator which synchronizes all access to an OutputStream
via an object provided to its constructor.
- Author:
- Christian Schlichtherle
- See Also:
SynchronizedInputStream
|
Field Summary |
protected Object |
lock
The object to synchronize on - never null. |
lock
protected final Object lock
- The object to synchronize on - never
null.
SynchronizedOutputStream
public SynchronizedOutputStream(OutputStream out)
- Constructs a new synchronized output stream.
This object will synchronize on itself.
- Parameters:
out - the output stream to wrap in this decorator.
SynchronizedOutputStream
public SynchronizedOutputStream(OutputStream out,
Object lock)
- Constructs a new synchronized output stream.
- Parameters:
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.
write
public void write(int b)
throws IOException
- Overrides:
write in class DecoratingOutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write in class DecoratingOutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush in interface Flushable- Overrides:
flush in class DecoratingOutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Overrides:
close in class DecoratingOutputStream
- Throws:
IOException
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.