Documentation of 'jas2.util.FileReaderWithProgressBar' Java class
FileReaderWithProgressBar
jas2.util

Class FileReaderWithProgressBar

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


    public class FileReaderWithProgressBar
    extends java.io.FileInputStream
    This class should be used when you want to have a BoundedRangeModel display the progress as a file is being opened. The model is updated with each call to read, so it is ideally used in a BufferedReader where the stream is read in buffer-sized amounts. That way, the model updates only when the buffer is filled. For example, you might use it like this:
    BufferedReader input = new BufferedReader(new InputStreamReader(new FileReaderWithProgressBar(name, model)));
    See Also:
    BoundedRangeModel, BufferedReader, InputStreamReader
    • Constructor Summary

      Constructors 
      Constructor and Description
      FileReaderWithProgressBar(java.lang.String fileName, javax.swing.BoundedRangeModel model)
      Creates a new FileReaderWithProgressBar.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int read()
      Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
      int read(byte[] cbuf)
      Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
      int read(byte[] cbuf, int off, int len)
      Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
      long skip(long n)
      Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
      • Methods inherited from class java.io.FileInputStream

        available, close, getChannel, getFD
      • Methods inherited from class java.io.InputStream

        mark, markSupported, reset
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileReaderWithProgressBar

        public FileReaderWithProgressBar(java.lang.String fileName,
                                         javax.swing.BoundedRangeModel model)
                                  throws java.io.FileNotFoundException
        Creates a new FileReaderWithProgressBar.
        Parameters:
        fileName - the file to read
        model - the BoundedRangeModel to update
        Throws:
        java.io.FileNotFoundException - thrown from the constructor of FileInputStream
        See Also:
        BoundedRangeModel
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
        Overrides:
        read in class java.io.FileInputStream
        Throws:
        java.io.IOException
        See Also:
        FileInputStream, FileInputStream.read()
      • read

        public int read(byte[] cbuf)
                 throws java.io.IOException
        Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
        Overrides:
        read in class java.io.FileInputStream
        Throws:
        java.io.IOException
        See Also:
        FileInputStream, FileInputStream.read(byte[])
      • read

        public int read(byte[] cbuf,
                        int off,
                        int len)
                 throws java.io.IOException
        Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
        Overrides:
        read in class java.io.FileInputStream
        Throws:
        java.io.IOException
        See Also:
        FileInputStream, FileInputStream.read(byte[], int, int)
      • skip

        public long skip(long n)
                  throws java.io.IOException
        Works just like the equivalent method in FileInputStream, except that it updates the model to reflect the progress in reading the file.
        Overrides:
        skip in class java.io.FileInputStream
        Throws:
        java.io.IOException
        See Also:
        FileInputStream, FileInputStream.skip(long)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.