com.intersys.objects
Class CacheReader

java.lang.Object
  extended byjava.io.Reader
      extended bycom.intersys.objects.CacheReader
All Implemented Interfaces:
Serializable

public class CacheReader
extends Reader
implements Serializable

A CacheReader obtains input bytes from a Cache Database. Usually it is mapped to some global in Cache. This is a wrapper class around CharacterStream. Note, that if you use this wrapper class it is not reommended to use direct calls to CharacterStream.

See Also:
Class BinaryStream in Cache , GlobalCharacterStream, Serialized Form

Constructor Summary
CacheReader(CharacterStream stream)
           
 
Method Summary
 void close()
           
 void mark(int readlimit)
          Marks the current position in this input stream.
 boolean markSupported()
           
 int read()
           
 int read(char[] b, int off, int len)
           
 String read(int len)
           
 boolean ready()
           
 void reset()
          Repositions this stream to the position at the time the mark method was last called on this input stream.
 void rewind()
          Rewinds stream, so the next char will be the first char stored in this Cache Stream (the first char stored in global).
 void seek(long pos)
          Repositions this stream to the given position.
 long skip(long n)
          Skips over and discards n chars of data from this input stream.
 long tell()
          Returns the current position in the stream.
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheReader

public CacheReader(CharacterStream stream)
            throws CacheException
Method Detail

read

public int read(char[] b,
                int off,
                int len)
         throws IOException
Throws:
IOException

read

public int read()
         throws IOException
Throws:
IOException

rewind

public void rewind()
            throws CacheException
Rewinds stream, so the next char will be the first char stored in this Cache Stream (the first char stored in global).

Throws:
CacheException

tell

public long tell()
Returns the current position in the stream.

Note, this method works only if all calls to the underlying GlobalCharacterStream goes through this CacheReader object.

Returns:
Current position in Cache Stream.
See Also:
seek(long), rewind(), mark(int), reset(), GlobalCharacterStream

markSupported

public boolean markSupported()

mark

public void mark(int readlimit)
          throws IOException
Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same chars.

Note, this method works only if all calls to the underlying GlobalCharacterStream goes through this CacheReader object.

Parameters:
readlimit - Ignored.
Throws:
IOException
See Also:
seek(long), rewind(), tell(), reset()

reset

public void reset()
           throws IOException
Repositions this stream to the position at the time the mark method was last called on this input stream.

Note, this method works only if all calls to the underlying GlobalCharacterStream goes through this CacheReader object.

Throws:
IOException
See Also:
mark(int), seek(long), rewind(), tell()

seek

public void seek(long pos)
          throws IOException
Repositions this stream to the given position.

Note, this method works only if all calls to the underlying GlobalCharacterStream goes through this CacheReader object.

Parameters:
pos - New postition for the stream.
Throws:
IOException
See Also:
mark(int), seek(long), rewind(), tell()

skip

public long skip(long n)
          throws IOException
Skips over and discards n chars of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of chars, possibly 0. This may result from any of a number of conditions; reaching end of file before n chars have been skipped is only one possibility. The actual number of chars skipped is returned. If n is negative, no chars are skipped.

Parameters:
n - the number of chars to be skipped.
Returns:
the actual number of chars skipped.
Throws:
IOException - if an I/O error occurs.

read

public String read(int len)
            throws IOException
Throws:
IOException

ready

public boolean ready()
              throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException