Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest.util
Class ReadAheadIterator

    java.lang.Object
      com.sun.javatest.util.ReadAheadIterator

All Implemented Interfaces:
  java.util.Iterator

    public class ReadAheadIterator

extends java.lang.Object
implements java.util.Iterator

An iterator that can read ahead of the current position, either for performance reasons or to help find out the number of items returned by an iterator before accessing them.

Field Summary
`static int` | `FULL` A constant indicating that full read ahead is required.
`static int` | `LIMITED` A constant indicating that limited read ahead is required.
`static int` | `NONE` A constant indicating that no read ahead is required.

Constructor Summary
`ReadAheadIterator(java.util.Iterator source, int mode)` Create a ReadAheadIterator.
`ReadAheadIterator(java.util.Iterator source, int mode, int amount)` Create a ReadAheadIterator.

Method Summary
`int` | `getItemsFoundCount()` Get the number of items read (so far) from the underlying source iterator.
`int` | `getOutputQueueSize()` Deprecated. Will not be supported in the future.
`int` | `getUsedElementCount()` Deprecated. Will not be supported in the future.
`boolean` | `hasNext()`
`boolean` | `isReadAheadComplete()` Check if all available items from the underlying source iterator have been read.
`boolean` | `isSourceExhausted()` Deprecated. Use hasNext().
`java.lang.Object` | `next()`
`void` | `remove()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NONE

    public static final int NONE

  A constant indicating that no read ahead is required.

  See Also:
    `ReadAheadIterator(java.util.Iterator, int, int)`, Constant Field Values

### LIMITED

    public static final int LIMITED

  A constant indicating that limited read ahead is required.

  See Also:
    `ReadAheadIterator(java.util.Iterator, int, int)`, Constant Field Values

### FULL

    public static final int FULL

  A constant indicating that full read ahead is required.

  See Also:
    `ReadAheadIterator(java.util.Iterator, int, int)`, Constant Field Values

Constructor Detail

### ReadAheadIterator

    public ReadAheadIterator(java.util.Iterator source,
                             int mode)

  Create a ReadAheadIterator.

  Parameters:
    `source` - The iterator from which to read ahead
    `mode` - A value indicating the type of read ahead required.
  See Also:
    `NONE`, `LIMITED`, `FULL`

### ReadAheadIterator

    public ReadAheadIterator(java.util.Iterator source,
                             int mode,
                             int amount)

  Create a ReadAheadIterator.

  Parameters:
    `source` - The iterator from which to read ahead.
    `mode` - A value indicating the type of read ahead required.
    `amount` - A value indicating the amount of read ahead required, if the mode is set to LIMITED. If the mode is NON or FULL, this parameter will be ignored.
  See Also:
    `NONE`, `LIMITED`, `FULL`

Method Detail

### isReadAheadComplete

    public boolean isReadAheadComplete()

  Check if all available items from the underlying source iterator have been read.

  Returns:
    true if all available items from the underlying source iterator have been read.

### getItemsFoundCount

    public int getItemsFoundCount()

  Get the number of items read (so far) from the underlying source iterator. If the read ahead has not yet completed, this will be a partial count of the total set of items available to be read. If the read ahead is complete, the value will be the total number of items returned from the underlying source iterator.

  Returns:
    the number of items (so far) from the underlying source iterator.
  See Also:
    `isReadAheadComplete()`

### isSourceExhausted

    public boolean isSourceExhausted()

  Deprecated. Use hasNext().

  Are there items that have not be read-ahead yet?

  Returns:
    True if the source has no more elements, false otherwise.

### getUsedElementCount

    public int getUsedElementCount()

  Deprecated. Will not be supported in the future.

  How many elements have been distributed through `getNext()`.

  Returns:
    number of used elements, greater-than or equal-to zero
  See Also:
    `getItemsFoundCount()`

### getOutputQueueSize

    public int getOutputQueueSize()

  Deprecated. Will not be supported in the future.

  Number of items have been read-ahead by not distributed.

  Returns:
    number of items ready to be distributed, greater-than or equal-to zero

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `java.util.Iterator`

### next

    public java.lang.Object next()

  Specified by:
    `next` in interface `java.util.Iterator`

### remove

    public void remove()

  Specified by:
    `remove` in interface `java.util.Iterator`
  Throws:
    `java.lang.UnsupportedOperationException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.