public interface ForwardCursor<V>
extends java.lang.Iterable<V>, java.io.Closeable
EntityCursor
for general information on cursors.
ForwardCursor
objects are not thread-safe. Cursors
should be opened, used and closed by a single thread.
WARNING: Cursors must always be closed to prevent resource leaks
which could lead to the index becoming unusable or cause an
OutOfMemoryError
. To ensure that a cursor is closed in the
face of exceptions, close it in a finally block.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the cursor.
|
java.util.Iterator<V> |
iterator()
Returns an iterator over the key range, starting with the value
following the current position or at the first value if the cursor is
uninitialized.
|
java.util.Iterator<V> |
iterator(LockMode lockMode)
Returns an iterator over the key range, starting with the value
following the current position or at the first value if the cursor is
uninitialized.
|
V |
next()
Moves the cursor to the next value and returns it, or returns null
if there are no more values in the cursor range.
|
V |
next(LockMode lockMode)
Moves the cursor to the next value and returns it, or returns null
if there are no more values in the cursor range.
|
V next() throws DatabaseException
LockMode.DEFAULT
is used implicitly.
OperationFailureException
- if one of the Read Operation
Failures occurs.EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.V next(LockMode lockMode) throws DatabaseException
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.OperationFailureException
- if one of the Read Operation
Failures occurs.EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.java.util.Iterator<V> iterator()
LockMode.DEFAULT
is used implicitly.
iterator
in interface java.lang.Iterable<V>
java.util.Iterator<V> iterator(LockMode lockMode)
lockMode
- the lock mode to use for all operations performed
using the iterator, or null to use LockMode.DEFAULT
.void close() throws DatabaseException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
DatabaseException
- the base class for all BDB exceptions.Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.