|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
de.schlichtherle.io.util.SynchronizedInputStream
public class SynchronizedInputStream
A decorator which synchronizes all access to an InputStream
via an object provided to its constructor.
Field Summary | |
---|---|
protected InputStream |
in
The decorated input stream. |
protected Object |
lock
The object to synchronize on - never null . |
Constructor Summary | |
---|---|
SynchronizedInputStream(InputStream in)
Constructs a new synchronized input stream. |
|
SynchronizedInputStream(InputStream in,
Object lock)
Constructs a new synchronized input stream. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
Synchronizes on the lock and calls doClose() . |
protected void |
doClose()
Closes the underlying stream. |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
|
long |
skip(long n)
|
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 InputStream in
Constructor Detail |
---|
public SynchronizedInputStream(InputStream in)
in
- The input stream to wrap in this decorator.public SynchronizedInputStream(InputStream in, Object lock)
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.Method Detail |
---|
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
lock
and calls doClose()
.
close
in interface Closeable
close
in class InputStream
IOException
protected void doClose() throws IOException
IOException
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |