public class ObservableInputStream extends FilterInputStream
in
Constructor and Description |
---|
ObservableInputStream(InputStream in,
InputStreamObserver listener)
Constructs an object to observer the progress of an input stream.
|
ObservableInputStream(InputStream in,
long size,
InputStreamObserver listener)
Constructs an object to observer the progress of an input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Overrides
FilterInputStream.close
to close the progress observer as well as the stream. |
long |
getNumBytesRead() |
long |
getNumBytesTotal() |
InputStreamObserver |
getObserver() |
int |
read()
Overrides
FilterInputStream.read
to update the progress observer after the read. |
int |
read(byte[] b)
Overrides
FilterInputStream.read
to update the progress observer after the read. |
int |
read(byte[] b,
int off,
int len)
Overrides
FilterInputStream.read
to update the progress observer after the read. |
void |
reset()
Overrides
FilterInputStream.reset
to reset the progress observer as well as the stream. |
long |
skip(long n)
Overrides
FilterInputStream.skip
to update the progress observer after the skip. |
available, mark, markSupported
public ObservableInputStream(InputStream in, InputStreamObserver listener)
in
- The input stream to be monitored.listener
- the listener to be informedpublic ObservableInputStream(InputStream in, long size, InputStreamObserver listener)
in
- The input stream to be monitored.listener
- the listener to be informedpublic long getNumBytesTotal()
public long getNumBytesRead()
public InputStreamObserver getObserver()
public int read() throws IOException
FilterInputStream.read
to update the progress observer after the read.read
in class FilterInputStream
IOException
public int read(byte[] b) throws IOException
FilterInputStream.read
to update the progress observer after the read.read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
FilterInputStream.read
to update the progress observer after the read.read
in class FilterInputStream
IOException
public long skip(long n) throws IOException
FilterInputStream.skip
to update the progress observer after the skip.skip
in class FilterInputStream
IOException
public void close() throws IOException
FilterInputStream.close
to close the progress observer as well as the stream.close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
public void reset() throws IOException
FilterInputStream.reset
to reset the progress observer as well as the stream.reset
in class FilterInputStream
IOException
Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.