|
|||||||||
| 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 InputStreamIOException
public int read(byte[] b)
throws IOException
read in class InputStreamIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOException
public long skip(long n)
throws IOException
skip in class InputStreamIOException
public int available()
throws IOException
available in class InputStreamIOException
public void close()
throws IOException
lock and calls doClose().
close in interface Closeableclose in class InputStreamIOException
protected void doClose()
throws IOException
IOExceptionpublic void mark(int readlimit)
mark in class InputStream
public void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStream
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||