public class MonitorInputStream
extends java.io.BufferedInputStream
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicLong |
atomicCount |
private static int |
EOF_CHAR |
private java.util.concurrent.atomic.AtomicBoolean |
finished |
| Constructor and Description |
|---|
MonitorInputStream(java.io.InputStream in)
Constructs a MonitorInputStream from the passed InputStream
|
MonitorInputStream(java.io.InputStream in,
int bufferSize)
Constructs a MonitorInputStream from the passed InputStream and with the specified buffer size
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns 0 if the stream is at EOF, else the underlying inputStream will be queried.
|
void |
close()
Closes this input stream and releases any system resources associated with the stream.
|
long |
getCount()
Get the number of bytes read by this input stream.
|
protected void |
onClose()
Called after the stream has been closed.
|
int |
read()
Reads a character.
|
int |
read(byte[] buffer,
int offset,
int length)
Reads bytes from this input stream.
|
private static final int EOF_CHAR
private final java.util.concurrent.atomic.AtomicBoolean finished
private final java.util.concurrent.atomic.AtomicLong atomicCount
public MonitorInputStream(java.io.InputStream in)
in - The input stream to wrap.public MonitorInputStream(java.io.InputStream in,
int bufferSize)
in - The input stream to wrap.bufferSize - The buffer size to use.public int available()
throws java.io.IOException
available in class java.io.BufferedInputStreamjava.io.IOException - if an error occurs.public int read()
throws java.io.IOException
read in class java.io.BufferedInputStreamjava.io.IOException - if an error occurs.public int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
read in class java.io.BufferedInputStreambuffer - A byte array in which to place the characters read.offset - The offset at which to start reading.length - The maximum number of bytes to read.java.io.IOException - if an error occurs.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.BufferedInputStreamjava.io.IOException - if an error occurs.protected void onClose()
throws java.io.IOException
java.io.IOException - if an error occurs.public long getCount()