org.apache.jackrabbit.rmi.remote
Class BufferIterator

java.lang.Object
  extended by org.apache.jackrabbit.rmi.remote.BufferIterator
All Implemented Interfaces:
Serializable, Remote, RemoteIterator

public class BufferIterator
extends Object
implements RemoteIterator, Serializable

A buffered remote iterator. Used to transfer a remote iterator reference along with a buffer of the first few iterator elements in one network transmission.

See Also:
Serialized Form

Constructor Summary
BufferIterator(Object[] buffer, long size, RemoteIterator remote)
          Creates a new buffered remote iterator.
 
Method Summary
 long getSize()
          Returns the cached size of the iterator.
 Object[] nextObjects()
          Returns the currently buffered elements and fills in the buffer with next elements.
 void skip(long items)
          Skips the given number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferIterator

public BufferIterator(Object[] buffer,
                      long size,
                      RemoteIterator remote)
Creates a new buffered remote iterator.

Parameters:
buffer - first elements in the iterator
size - total iterator size
remote - reference to the remaining iterator
Method Detail

getSize

public long getSize()
Returns the cached size of the iterator.

Specified by:
getSize in interface RemoteIterator
Returns:
iterator size, or -1 if unknown
See Also:
RemoteIterator.getSize()

skip

public void skip(long items)
          throws IllegalArgumentException,
                 NoSuchElementException,
                 RemoteException
Skips the given number of elements. First discards elements from the element buffer and only then contacts the remote iterator.

Specified by:
skip in interface RemoteIterator
Parameters:
items - number of items to skip
Throws:
IllegalArgumentException - if items is negative
NoSuchElementException - if skipped past the last element
RemoteException - on RMI errors
See Also:
RemoteIterator.skip(long)

nextObjects

public Object[] nextObjects()
                     throws RemoteException
Returns the currently buffered elements and fills in the buffer with next elements.

Specified by:
nextObjects in interface RemoteIterator
Returns:
buffered elements, or null if the iterator has ended
Throws:
RemoteException - on RMI errors
See Also:
RemoteIterator.nextObjects()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.