org.knime.base.node.util
Class BufferedFileReader.ByteCountingStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.knime.base.node.util.BufferedFileReader.ByteCountingStream
All Implemented Interfaces:
Closeable
Enclosing class:
BufferedFileReader

static class BufferedFileReader.ByteCountingStream
extends InputStream

Wraps an input stream and counts the number of bytes read from the stream.

Author:
ohl, University of Konstanz

Constructor Summary
BufferedFileReader.ByteCountingStream(InputStream in)
           
 
Method Summary
 long bytesRead()
           
 void close()
          
 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)
          
 
Methods inherited from class java.io.InputStream
available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedFileReader.ByteCountingStream

public BufferedFileReader.ByteCountingStream(InputStream in)
Parameters:
in - the input stream to wrap and count the bytes read.
Method Detail

read

public int read()
         throws IOException

Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException

Overrides:
read in class InputStream
Throws:
IOException

read

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

Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException

Overrides:
skip in class InputStream
Throws:
IOException

bytesRead

public long bytesRead()
Returns:
the number of bytes read from the stream. As soon as the end of the stream is reached this number is not accurate anymore. (As it also counts the "end-of-file" tags returned.)

markSupported

public boolean markSupported()

Overrides:
markSupported in class InputStream

reset

public void reset()
           throws IOException

Overrides:
reset in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)

Overrides:
mark in class InputStream

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.