de.schlichtherle.truezip.io
Class SynchronizedInputStream
java.lang.Object
java.io.InputStream
de.schlichtherle.truezip.io.DecoratingInputStream
de.schlichtherle.truezip.io.SynchronizedInputStream
- All Implemented Interfaces:
- Closeable
- Direct Known Subclasses:
- ConcurrentInputShop.SynchronizedConcurrentInputStream
public class SynchronizedInputStream
- extends DecoratingInputStream
A decorator which synchronizes all access to an InputStream
via an object provided to its constructor.
- Author:
- Christian Schlichtherle
- See Also:
SynchronizedOutputStream
|
Field Summary |
protected Object |
lock
The object to synchronize on - never null. |
lock
protected final Object lock
- The object to synchronize on - never
null.
SynchronizedInputStream
public SynchronizedInputStream(InputStream in)
- Constructs a new synchronized input stream.
This object will synchronize on itself.
- Parameters:
in - the input stream to wrap in this decorator.
SynchronizedInputStream
public SynchronizedInputStream(InputStream in,
Object lock)
- Constructs a new synchronized input stream.
- Parameters:
in - the input stream to wrap in this decorator.lock - the object to synchronize on.
If null, then this object is used, not the stream.
read
public int read()
throws IOException
- Overrides:
read in class DecoratingInputStream
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read in class DecoratingInputStream
- Throws:
IOException
skip
public long skip(long n)
throws IOException
- Overrides:
skip in class DecoratingInputStream
- Throws:
IOException
available
public int available()
throws IOException
- Overrides:
available in class DecoratingInputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Overrides:
close in class DecoratingInputStream
- Throws:
IOException
mark
public void mark(int readlimit)
- Overrides:
mark in class DecoratingInputStream
reset
public void reset()
throws IOException
- Overrides:
reset in class DecoratingInputStream
- Throws:
IOException
markSupported
public boolean markSupported()
- Overrides:
markSupported in class DecoratingInputStream
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.