|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream org.deckfour.xes.util.progress.XMonitoredInputStream
public class XMonitoredInputStream
This class implements an input stream which can provide a progress listener with feedback about how much of the data in the stream has already been read. This is a useful utility for reading XML-based data, while still providing feedback about expected progress.
Field Summary | |
---|---|
protected long |
bytesRead
Number of bytes read so far. |
protected int |
lastStep
The last step which has been notified about. |
protected XProgressListener |
progressListener
Progress listener which is being notified. |
protected int |
stepNumber
The number of steps to be used for progress expression. |
protected long |
stepSize
Number of bytes per step. |
protected InputStream |
stream
Wrapped, monitored input stream. |
Constructor Summary | |
---|---|
XMonitoredInputStream(File file,
XProgressListener progressListener)
Creates a new monitored input stream. |
|
XMonitoredInputStream(InputStream stream,
long size,
JProgressBar progressBar)
Creates a new monitored input stream. |
|
XMonitoredInputStream(InputStream stream,
long size,
XProgressListener progressListener)
Creates a new monitored input stream. |
|
XMonitoredInputStream(InputStream stream,
long size,
XProgressListener progressListener,
int stepNumber)
Creates a new monitored input stream. |
Method Summary | |
---|---|
int |
getStepNumber()
Returns the number of steps so far. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
long |
skip(long n)
|
protected void |
update(long readBytes)
This method is called by the actual input stream method to provide feedback about the number of read bytes. |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int stepNumber
protected long stepSize
protected int lastStep
protected long bytesRead
protected InputStream stream
protected XProgressListener progressListener
Constructor Detail |
---|
public XMonitoredInputStream(File file, XProgressListener progressListener) throws FileNotFoundException
file
- The file to be read from.progressListener
- Progress listener to be notified.
FileNotFoundException
public XMonitoredInputStream(InputStream stream, long size, JProgressBar progressBar)
stream
- Monitored, wrapped lower-level input stream.size
- Number of bytes to be read from the stream.progressBar
- Progress bar to be updated.public XMonitoredInputStream(InputStream stream, long size, XProgressListener progressListener)
stream
- Monitored, wrapped lower-level input stream.size
- Number of bytes to be read from the stream.progressListener
- Progress listener to be notified.public XMonitoredInputStream(InputStream stream, long size, XProgressListener progressListener, int stepNumber)
stream
- Monitored, wrapped lower-level input stream.size
- Number of bytes to be read from the stream.progressListener
- Progress listener to be notified.stepNumber
- Number of steps used to express progress.Method Detail |
---|
protected void update(long readBytes) throws IOException
readBytes
- The number of read bytes in this call.
IOException
public int getStepNumber()
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |