org.apache.jackrabbit.rmi.remote
Class ArrayIterator

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

public class ArrayIterator
extends Object
implements RemoteIterator, Serializable

A simple array-based remote iterator. Used when the iteration is short enough for all the elements to be sent over the network in one go.

See Also:
Serialized Form

Constructor Summary
ArrayIterator(Object[] elements)
          Creates an array-based remote iterator from the given array of remote references or serializable objects.
 
Method Summary
 long getSize()
          Returns the size of the iterator.
 Object[] nextObjects()
          Returns the underlying array.
 void skip(long items)
          Skips the first items elements in the array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterator

public ArrayIterator(Object[] elements)
Creates an array-based remote iterator from the given array of remote references or serializable objects.

Parameters:
elements - elements of the iteration
Method Detail

getSize

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

Specified by:
getSize in interface RemoteIterator
Returns:
length of the iterator
See Also:
RemoteIterator.getSize()

skip

public void skip(long items)
          throws IllegalArgumentException,
                 NoSuchElementException
Skips the first items elements in the array. Skips the given number of elements in this iteration.

Specified by:
skip in interface RemoteIterator
Parameters:
items - number of elements to skip
Throws:
NoSuchElementException - if skipped past the last element
IllegalArgumentException
See Also:
RangeIterator.skip(long)

nextObjects

public Object[] nextObjects()
                     throws IllegalArgumentException
Returns the underlying array. Returns an array of remote references to the next elements in this iterator. Returns null if the end of this iteration has been reached.

To reduce the amount of remote method calls, this method returns an array of one or more elements in this iteration.

Specified by:
nextObjects in interface RemoteIterator
Returns:
array of remote references, or null
Throws:
IllegalArgumentException - if maxItems is not positive
See Also:
Iterator.next()


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