org.apache.commons.vfs.util
Class MonitorInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by org.apache.commons.vfs.util.MonitorInputStream
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
DefaultFileContent.FileContentInputStream, FtpFileObject.FtpInputStream, HttpFileObject.HttpInputStream

public class MonitorInputStream
extends java.io.BufferedInputStream

An InputStream that provides buffering and end-of-stream monitoring.

Version:
$Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
Author:
Adam Murdoch

Field Summary
private  long count
           
private  boolean finished
           
 
Fields inherited from class java.io.BufferedInputStream
buf, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
MonitorInputStream(java.io.InputStream in)
           
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 long getCount()
          Get the nuber of bytes read by this input stream
protected  void onClose()
          Called after the stream has been closed.
 int read()
          Reads a character.
 int read(byte[] buffer, int offset, int length)
          Reads bytes from this input stream.error occurs.
 
Methods inherited from class java.io.BufferedInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finished

private boolean finished

count

private long count
Constructor Detail

MonitorInputStream

public MonitorInputStream(java.io.InputStream in)
Method Detail

read

public int read()
         throws java.io.IOException
Reads a character.

Overrides:
read in class java.io.BufferedInputStream
Throws:
java.io.IOException

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Reads bytes from this input stream.error occurs.

Overrides:
read in class java.io.BufferedInputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes this input stream and releases any system resources associated with the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.BufferedInputStream
Throws:
java.io.IOException

onClose

protected void onClose()
                throws java.io.IOException
Called after the stream has been closed. This implementation does nothing.

Throws:
java.io.IOException

getCount

public long getCount()
Get the nuber of bytes read by this input stream