com.onewebsql.util.io
Class CountingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.onewebsql.util.io.ProxyInputStream
              extended by com.onewebsql.util.io.CountReportingInputStream
                  extended by com.onewebsql.util.io.CountingInputStream
All Implemented Interfaces:
Closeable

public class CountingInputStream
extends CountReportingInputStream

Implementacja strumienia wejściowego zliczająca odczytane bajty.


Field Summary
protected  long count
          Liczba odczytanych bajtów.
protected  long mark
          Znacznik zapamiętanej pozycji w strumieniu.
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CountingInputStream(InputStream proxy)
          Konstruktor.
 
Method Summary
 long getCount()
          Zwraca liczbę odczytanych bajtów.
 void mark(int idx)
          Invokes the delegate's mark(int) method.
 boolean markSupported()
          Invokes the delegate's markSupported() method.
 int read()
          Invokes the delegate's read() method.
 int read(byte[] bts)
          Invokes the delegate's read(byte[]) method.
 int read(byte[] bts, int st, int end)
          Invokes the delegate's read(byte[], int, int) method.
 void reset()
          Invokes the delegate's reset() method.
 long skip(long ln)
          Invokes the delegate's skip(long) method.
 
Methods inherited from class com.onewebsql.util.io.ProxyInputStream
available, close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

protected long count
Liczba odczytanych bajtów.


mark

protected long mark
Znacznik zapamiętanej pozycji w strumieniu.

Constructor Detail

CountingInputStream

public CountingInputStream(InputStream proxy)
Konstruktor.

Parameters:
proxy - strumień wejściowy, z którego odczytywane będą dane.
Method Detail

getCount

public long getCount()
Description copied from class: CountReportingInputStream
Zwraca liczbę odczytanych bajtów.

Specified by:
getCount in class CountReportingInputStream
Returns:
liczba odczytanych bajtów.

mark

public void mark(int idx)
Description copied from class: ProxyInputStream
Invokes the delegate's mark(int) method.

Overrides:
mark in class ProxyInputStream
Parameters:
idx - read ahead limit

markSupported

public boolean markSupported()
Description copied from class: ProxyInputStream
Invokes the delegate's markSupported() method.

Overrides:
markSupported in class ProxyInputStream
Returns:
true if mark is supported, otherwise false

read

public int read()
         throws IOException
Description copied from class: ProxyInputStream
Invokes the delegate's read() method.

Overrides:
read in class ProxyInputStream
Returns:
the byte read or -1 if the end of stream
Throws:
IOException - if an I/O error occurs

read

public int read(byte[] bts,
                int st,
                int end)
         throws IOException
Description copied from class: ProxyInputStream
Invokes the delegate's read(byte[], int, int) method.

Overrides:
read in class ProxyInputStream
Parameters:
bts - the buffer to read the bytes into
st - The start offset
end - The number of bytes to read
Returns:
the number of bytes read or -1 if the end of stream
Throws:
IOException - if an I/O error occurs

read

public int read(byte[] bts)
         throws IOException
Description copied from class: ProxyInputStream
Invokes the delegate's read(byte[]) method.

Overrides:
read in class ProxyInputStream
Parameters:
bts - the buffer to read the bytes into
Returns:
the number of bytes read or -1 if the end of stream
Throws:
IOException - if an I/O error occurs

reset

public void reset()
           throws IOException
Description copied from class: ProxyInputStream
Invokes the delegate's reset() method.

Overrides:
reset in class ProxyInputStream
Throws:
IOException - if an I/O error occurs

skip

public long skip(long ln)
          throws IOException
Description copied from class: ProxyInputStream
Invokes the delegate's skip(long) method.

Overrides:
skip in class ProxyInputStream
Parameters:
ln - the number of bytes to skip
Returns:
the number of bytes to skipped or -1 if the end of stream
Throws:
IOException - if an I/O error occurs


Copyright © 2011-2013 e-point SA. All Rights Reserved.