Quadcap Embeddable Database

com.quadcap.io.CountedInputStream Class Reference

Inheritance diagram for com.quadcap.io.CountedInputStream:

InputStream List of all members.

Detailed Description

This class implements an input stream filter which keeps track of how many bytes have been read.

Author:
Stan Bailes

Definition at line 54 of file CountedInputStream.java.

Public Member Functions

 CountedInputStream (InputStream in)
 Construct a new CountedInputStream reading from the specified base stream.

int read () throws IOException
 Read the next byte from this input stream.

int read (byte[] buf, int offset, int cnt) throws IOException
 Read a block of bytes from this input stream.

int read (byte[] buf) throws IOException
 Read a block of bytes from this input stream.

int available () throws IOException
 Return the number of bytes that can be read without blocking.

void close () throws IOException
 Close the stream.

long skip (long n) throws IOException
 Skip ahead in the stream.

void mark (int readLimit)
 Mark the current position in the input stream.

void reset () throws IOException
 Return to the previously marked position in the input stream.

boolean markSupported ()
 Return true if mark/reset supported (they are.).

int getPosition ()
 Return the number of bytes read so far from this input stream.

void setPosition (int pos)
 Set the current position.


Package Attributes

InputStream in
int pos = 0


Constructor & Destructor Documentation

com.quadcap.io.CountedInputStream.CountedInputStream InputStream  in  ) 
 

Construct a new CountedInputStream reading from the specified base stream.

Parameters:
in the input stream

Definition at line 64 of file CountedInputStream.java.


Member Function Documentation

int com.quadcap.io.CountedInputStream.available  )  throws IOException
 

Return the number of bytes that can be read without blocking.

Definition at line 103 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in.

void com.quadcap.io.CountedInputStream.close  )  throws IOException
 

Close the stream.

Definition at line 110 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in.

int com.quadcap.io.CountedInputStream.getPosition  ) 
 

Return the number of bytes read so far from this input stream.

Definition at line 145 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.pos.

void com.quadcap.io.CountedInputStream.mark int  readLimit  ) 
 

Mark the current position in the input stream.

Definition at line 124 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in, and com.quadcap.io.CountedInputStream.mark().

Referenced by com.quadcap.io.CountedInputStream.mark().

boolean com.quadcap.io.CountedInputStream.markSupported  ) 
 

Return true if mark/reset supported (they are.).

Definition at line 138 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in.

int com.quadcap.io.CountedInputStream.read byte[]  buf  )  throws IOException
 

Read a block of bytes from this input stream.

Exceptions:
IOException if an I/O error occcurs.

Definition at line 94 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in, and com.quadcap.io.CountedInputStream.pos.

int com.quadcap.io.CountedInputStream.read byte[]  buf,
int  offset,
int  cnt
throws IOException
 

Read a block of bytes from this input stream.

Exceptions:
IOException if an I/O error occcurs.

Definition at line 83 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in, and com.quadcap.io.CountedInputStream.pos.

int com.quadcap.io.CountedInputStream.read  )  throws IOException
 

Read the next byte from this input stream.

Exceptions:
IOException if an I/O error occurs.

Definition at line 73 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in, and com.quadcap.io.CountedInputStream.pos.

void com.quadcap.io.CountedInputStream.reset  )  throws IOException
 

Return to the previously marked position in the input stream.

Definition at line 131 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in.

void com.quadcap.io.CountedInputStream.setPosition int  pos  ) 
 

Set the current position.

Definition at line 152 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.setPosition().

Referenced by com.quadcap.io.CountedInputStream.setPosition().

long com.quadcap.io.CountedInputStream.skip long  n  )  throws IOException
 

Skip ahead in the stream.

Definition at line 117 of file CountedInputStream.java.

References com.quadcap.io.CountedInputStream.in, and com.quadcap.io.CountedInputStream.skip().

Referenced by com.quadcap.io.CountedInputStream.skip().


Member Data Documentation

InputStream com.quadcap.io.CountedInputStream.in [package]
 

Definition at line 55 of file CountedInputStream.java.

Referenced by com.quadcap.io.CountedInputStream.available(), com.quadcap.io.CountedInputStream.close(), com.quadcap.io.CountedInputStream.mark(), com.quadcap.io.CountedInputStream.markSupported(), com.quadcap.io.CountedInputStream.read(), com.quadcap.io.CountedInputStream.reset(), and com.quadcap.io.CountedInputStream.skip().

int com.quadcap.io.CountedInputStream.pos = 0 [package]
 

Definition at line 56 of file CountedInputStream.java.

Referenced by com.quadcap.io.CountedInputStream.getPosition(), and com.quadcap.io.CountedInputStream.read().