Class FileProgressInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- de.ipk_gatersleben.bit.bi.edal.publication.metadata.FileProgressInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class FileProgressInputStream extends java.io.FilterInputStream
-
-
Constructor Summary
Constructors Constructor Description FileProgressInputStream(javax.swing.JProgressBar fileProgressBar, java.io.InputStream inputStream, java.lang.String filename, long length)
Constructs an object to monitor the progress of an input stream.
-
Method Summary
Modifier and Type Method Description void
close()
OverridesFilterInputStream.close
to close the progress monitor as well as the stream.FileProgressMonitor
getProgressMonitor()
Get the ProgressMonitor object being used by this stream.int
read()
OverridesFilterInputStream.read
to update the progress monitor after the read.int
read(byte[] b)
OverridesFilterInputStream.read
to update the progress monitor after the read.int
read(byte[] b, int off, int len)
OverridesFilterInputStream.read
to update the progress monitor after the read.void
reset()
OverridesFilterInputStream.reset
to reset the progress monitor as well as the stream.long
skip(long n)
OverridesFilterInputStream.skip
to update the progress monitor after the skip.
-
-
-
Constructor Detail
-
FileProgressInputStream
public FileProgressInputStream(javax.swing.JProgressBar fileProgressBar, java.io.InputStream inputStream, java.lang.String filename, long length)
Constructs an object to monitor the progress of an input stream.- Parameters:
inputStream
- The input stream to be monitored.fileProgressBar
- the correspondingJProgressBar
filename
- the name of the file to streamlength
- the file length
-
-
Method Detail
-
getProgressMonitor
public FileProgressMonitor getProgressMonitor()
Get the ProgressMonitor object being used by this stream. Normally this isn't needed unless you want to do something like change the descriptive text partway through reading the file.- Returns:
- the ProgressMonitor object used by this object
-
read
public int read() throws java.io.IOException
OverridesFilterInputStream.read
to update the progress monitor after the read.- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
OverridesFilterInputStream.read
to update the progress monitor after the read.- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
OverridesFilterInputStream.read
to update the progress monitor after the read.- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
OverridesFilterInputStream.skip
to update the progress monitor after the skip.- Overrides:
skip
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
OverridesFilterInputStream.close
to close the progress monitor as well as the stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
OverridesFilterInputStream.reset
to reset the progress monitor as well as the stream.- Overrides:
reset
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-