|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FileInputStream
jas.util.FileReaderWithProgressBar
public class FileReaderWithProgressBar
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)));
BoundedRangeModel,
BufferedReader,
InputStreamReader| Constructor Summary | |
|---|---|
FileReaderWithProgressBar(String fileName,
BoundedRangeModel model)
Creates a new FileReaderWithProgressBar. |
|
| Method Summary | |
|---|---|
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, finalize, getChannel, getFD |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileReaderWithProgressBar(String fileName,
BoundedRangeModel model)
throws FileNotFoundException
fileName - the file to readmodel - the BoundedRangeModel to update
FileNotFoundException - thrown from the constructor of FileInputStreamBoundedRangeModel| Method Detail |
|---|
public int read()
throws IOException
read in class FileInputStreamIOExceptionFileInputStream,
FileInputStream.read()
public int read(byte[] cbuf)
throws IOException
read in class FileInputStreamIOExceptionFileInputStream,
FileInputStream.read(byte[])
public int read(byte[] cbuf,
int off,
int len)
throws IOException
read in class FileInputStreamIOExceptionFileInputStream,
FileInputStream.read(byte[], int, int)
public long skip(long n)
throws IOException
skip in class FileInputStreamIOExceptionFileInputStream,
FileInputStream.skip(long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||