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 voidclose()OverridesFilterInputStream.closeto close the progress monitor as well as the stream.FileProgressMonitorgetProgressMonitor()Get the ProgressMonitor object being used by this stream.intread()OverridesFilterInputStream.readto update the progress monitor after the read.intread(byte[] b)OverridesFilterInputStream.readto update the progress monitor after the read.intread(byte[] b, int off, int len)OverridesFilterInputStream.readto update the progress monitor after the read.voidreset()OverridesFilterInputStream.resetto reset the progress monitor as well as the stream.longskip(long n)OverridesFilterInputStream.skipto 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 correspondingJProgressBarfilename- 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.IOExceptionOverridesFilterInputStream.readto update the progress monitor after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOExceptionOverridesFilterInputStream.readto update the progress monitor after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionOverridesFilterInputStream.readto update the progress monitor after the read.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOExceptionOverridesFilterInputStream.skipto update the progress monitor after the skip.- Overrides:
skipin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionOverridesFilterInputStream.closeto close the progress monitor as well as the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOExceptionOverridesFilterInputStream.resetto reset the progress monitor as well as the stream.- Overrides:
resetin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
-