Class FileProgressInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class FileProgressInputStream
    extends java.io.FilterInputStream
    • Field Summary

      • Fields inherited from class java.io.FilterInputStream

        in
    • 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()
      Overrides FilterInputStream.close to close the progress monitor as well as the stream.
      FileProgressMonitor getProgressMonitor()
      Get the ProgressMonitor object being used by this stream.
      int read()
      Overrides FilterInputStream.read to update the progress monitor after the read.
      int read​(byte[] b)
      Overrides FilterInputStream.read to update the progress monitor after the read.
      int read​(byte[] b, int off, int len)
      Overrides FilterInputStream.read to update the progress monitor after the read.
      void reset()
      Overrides FilterInputStream.reset to reset the progress monitor as well as the stream.
      long skip​(long n)
      Overrides FilterInputStream.skip to update the progress monitor after the skip.
      • Methods inherited from class java.io.FilterInputStream

        available, mark, markSupported
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 corresponding JProgressBar
        filename - the name of the file to stream
        length - 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
        Overrides FilterInputStream.read to update the progress monitor after the read.
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides FilterInputStream.read to update the progress monitor after the read.
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides FilterInputStream.read to update the progress monitor after the read.
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides FilterInputStream.skip to update the progress monitor after the skip.
        Overrides:
        skip in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Overrides FilterInputStream.close to close the progress monitor as well as the stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides FilterInputStream.reset to reset the progress monitor as well as the stream.
        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException