org.semanticdesktop.aperture.accessor.base
Class CountingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.semanticdesktop.aperture.accessor.base.CountingInputStream
All Implemented Interfaces:
Closeable

public class CountingInputStream
extends InputStream

A utility class that wraps an InputStream and counts the bytes read from the stream to provide the getCurrentByte() method.


Constructor Summary
CountingInputStream(InputStream wrappedInputStream)
          A main constructor.
 
Method Summary
 int available()
           
 void close()
           
 boolean equals(Object obj)
           
 long getCurrentByte()
           
 int hashCode()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CountingInputStream

public CountingInputStream(InputStream wrappedInputStream)
A main constructor.

Parameters:
wrappedInputStream -
Method Detail

getCurrentByte

public long getCurrentByte()
Returns:
the zero-based index of the next byte to be read (or a count of the bytes that have been read from this stream).

available

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

close

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

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()

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[])

reset

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

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException
See Also:
InputStream.skip(long)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2010 Aperture Development Team. All Rights Reserved.