org.modeshape.common.util
Class SizeMeasuringInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.modeshape.common.util.SizeMeasuringInputStream
All Implemented Interfaces:
Closeable

public class SizeMeasuringInputStream
extends InputStream

An InputStream implementation that can wrap another input stream and determine the number of bytes read.


Constructor Summary
SizeMeasuringInputStream(InputStream stream, AtomicLong size)
           
 
Method Summary
 int available()
          
 void close()
          
 void mark(int readlimit)
          
 boolean markSupported()
          
 int read()
          
 int read(byte[] b)
          
 int read(byte[] b, int off, int len)
          
 void reset()
          
 
Methods inherited from class java.io.InputStream
skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeMeasuringInputStream

public SizeMeasuringInputStream(InputStream stream,
                                AtomicLong size)
Method Detail

read

public int read()
         throws IOException

Specified by:
read in class InputStream
Throws:
IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException

Overrides:
read in class InputStream
Throws:
IOException
See Also:
InputStream.read(byte[], int, int)

read

public int read(byte[] b)
         throws IOException

Overrides:
read in class InputStream
Throws:
IOException
See Also:
InputStream.read(byte[])

mark

public void mark(int readlimit)

Overrides:
mark in class InputStream
See Also:
InputStream.mark(int)

markSupported

public boolean markSupported()

Overrides:
markSupported in class InputStream
See Also:
InputStream.markSupported()

available

public int available()
              throws IOException

Overrides:
available in class InputStream
Throws:
IOException
See Also:
InputStream.available()

reset

public void reset()
           throws IOException

Overrides:
reset in class InputStream
Throws:
IOException
See Also:
InputStream.reset()

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException
See Also:
InputStream.close()


Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.