public interface ForwardCursor
extends java.io.Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
Discards the cursor.
|
OperationResult |
get(DatabaseEntry key,
DatabaseEntry data,
Get getType,
ReadOptions options)
Moves the cursor to a record according to the specified
Get
type. |
OperationStatus |
getCurrent(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Returns the key/data pair to which the cursor refers.
|
Database |
getDatabase()
Returns the Database handle associated with this ForwardCursor.
|
OperationStatus |
getNext(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
Moves the cursor to the next key/data pair and returns that pair.
|
Database getDatabase()
void close()
The cursor handle may not be used again after this method has been called, regardless of the method's success or failure.
WARNING: To guard against memory leaks, the application should discard all references to the closed handle. While BDB makes an effort to discard references from closed objects to the allocated memory for an environment, this behavior is not guaranteed. The safe course of action for an application is to discard all references to closed BDB objects.
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.OperationResult get(DatabaseEntry key, DatabaseEntry data, Get getType, ReadOptions options)
Get
type.key
- the key returned as
output.data
- the data returned as
output.getType
- is Get.NEXT
or Get.CURRENT
.
interface. Get.CURRENT
is permitted only if the cursor is
initialized (positioned on a record).options
- the ReadOptions, or null to use default options.OperationFailureException
- if one of the Read Operation
Failures occurs.EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.java.lang.IllegalStateException
- if the cursor or database has been closed,
the cursor is uninitialized (not positioned on a record) and this is not
permitted (see above), or the non-transactional cursor was created in a
different thread.java.lang.IllegalArgumentException
- if an invalid parameter is specified.
This includes passing a null getType, a null input key/data parameter,
an input key/data parameter with a null data array, a partial key/data
input parameter, and specifying a lock mode
of READ_COMMITTED.OperationStatus getCurrent(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
Calling this method is equivalent to calling get(DatabaseEntry, DatabaseEntry, Get, ReadOptions)
with
Get.CURRENT
.
key
- the key returned as
output.data
- the data returned as
output.lockMode
- the locking attributes; if null, default attributes are
used. LockMode.READ_COMMITTED
is not allowed.OperationStatus.KEYEMPTY
if the key/pair at the cursor position has
been deleted; otherwise, OperationStatus.SUCCESS
.OperationFailureException
- if one of the Read Operation
Failures occurs.java.lang.IllegalStateException
- if the cursor or database has been closed,
or the cursor is uninitialized (not positioned on a record), or the
non-transactional cursor was created in a different thread.java.lang.IllegalArgumentException
- if an invalid parameter is specified.OperationStatus getNext(DatabaseEntry key, DatabaseEntry data, LockMode lockMode)
Calling this method is equivalent to calling get(DatabaseEntry, DatabaseEntry, Get, ReadOptions)
with
Get.NEXT
.
key
- the key returned as
output.data
- the data returned as
output.lockMode
- the locking attributes; if null, default attributes are
used. LockMode.READ_COMMITTED
is not allowed.OperationStatus.NOTFOUND
if no matching key/data pair is found;
otherwise, OperationStatus.SUCCESS
.OperationFailureException
- if one of the Read Operation
Failures occurs.EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.java.lang.IllegalStateException
- if the cursor or database has been closed,
or the non-transactional cursor was created in a different thread.java.lang.IllegalArgumentException
- if an invalid parameter is specified.Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.