Package com.tagtraum.core
Class ProgressInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.tagtraum.core.ProgressInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ProgressInputStream extends FilterInputStream
Reports progress as it reads an InputStream.- Author:
- Hendrik Schreiber
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ProgressInputStream(File file)
Creates an inputstream from the given file.ProgressInputStream(InputStream in, long length)
Wraps the given inputstream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProgressListener(ProgressListener progressListener)
Adds aProgressListener
.Operation
getOperation()
boolean
markSupported()
int
read()
int
read(byte[] bytes, int i, int i1)
void
setOperation(Operation operation)
long
skip(long l)
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ProgressInputStream
public ProgressInputStream(File file) throws FileNotFoundException
Creates an inputstream from the given file.- Parameters:
file
- file to open- Throws:
FileNotFoundException
-
ProgressInputStream
public ProgressInputStream(InputStream in, long length)
Wraps the given inputstream.- Parameters:
in
- inputstream to wraplength
- total length in bytes
-
-
Method Detail
-
getOperation
public Operation getOperation()
-
setOperation
public void setOperation(Operation operation)
-
addProgressListener
public void addProgressListener(ProgressListener progressListener)
Adds aProgressListener
.- Parameters:
progressListener
- progress listener
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] bytes, int i, int i1) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
public long skip(long l) throws IOException
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classFilterInputStream
-
-