sk.baka.ambient
Class NotifyingInputStream
java.lang.Object
java.io.InputStream
sk.baka.ambient.commons.CountingInputStream
sk.baka.ambient.NotifyingInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class NotifyingInputStream
- extends CountingInputStream
Notifies periodically the BackgroundOpExecutor about its progress.
- Author:
- Martin Vysny
|
Constructor Summary |
NotifyingInputStream(java.io.InputStream in,
int length,
int parts,
java.lang.String caption)
|
|
Method Summary |
protected void |
countEvent(long currentPosition)
Invoked when the position |
static java.io.InputStream |
fromURL(java.net.URL url,
int parts,
java.lang.String caption)
Creates an input stream from given URL. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NotifyingInputStream
public NotifyingInputStream(java.io.InputStream in,
int length,
int parts,
java.lang.String caption)
- Parameters:
in - input streamlength - the length of the content.parts - reports the progress parts times.caption - the caption to set.
fromURL
public static java.io.InputStream fromURL(java.net.URL url,
int parts,
java.lang.String caption)
throws java.io.IOException
- Creates an input stream from given URL. If the url fails to supply
content length then a simple buffered input stream is returned.
- Parameters:
url - the URL to open.parts - reports the progress parts times.caption - the caption to set.
- Returns:
- the stream instance.
- Throws:
java.io.IOException
countEvent
protected void countEvent(long currentPosition)
- Description copied from class:
CountingInputStream
- Invoked when the position
- Specified by:
countEvent in class CountingInputStream
Copyright © 2007-2009. All Rights Reserved.