sk.baka.ambient
Class NotifyingInputStream
java.lang.Object
java.io.InputStream
sk.baka.ambient.commons.CountingInputStream
sk.baka.ambient.NotifyingInputStream
- All Implemented Interfaces:
- Closeable
public class NotifyingInputStream
- extends CountingInputStream
Notifies periodically the BackgroundOpExecutor
about its progress.
- Author:
- Martin Vysny
Method Summary |
protected void |
countEvent(long currentPosition)
Invoked when the position |
static InputStream |
fromURL(URL url,
int parts,
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(InputStream in,
int length,
int parts,
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 InputStream fromURL(URL url,
int parts,
String caption)
throws 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:
IOException
countEvent
protected void countEvent(long currentPosition)
- Description copied from class:
CountingInputStream
- Invoked when the position
- Specified by:
countEvent
in class CountingInputStream
Copyright © 2007-2008. All Rights Reserved.