public abstract class RawCursor<S> extends AbstractCursor<S>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.locks.Lock |
mLock
Lock object, as passed into the constructor
|
| Modifier | Constructor and Description |
|---|---|
protected |
RawCursor(java.util.concurrent.locks.Lock lock,
byte[] startBound,
boolean inclusiveStart,
byte[] endBound,
boolean inclusiveEnd,
int maxPrefix,
boolean reverse) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Call close to release any resources being held by this cursor.
|
protected int |
compareKeysPartially(byte[] key1,
byte[] key2)
Returns <0 if key1 is less, 0 if equal (at least partially),
>0 if key1 is greater.
|
protected void |
disableKeyAndValue()
An optimization hint which disables key and value acquisition.
|
protected void |
disableValue()
An optimization hint which disables just value acquisition.
|
protected void |
enableKeyAndValue()
Enable key and value acquisition again, after they have been
disabled.
|
protected abstract byte[] |
getCurrentKey()
Returns the contents of the current key being referenced, or null
otherwise.
|
protected abstract byte[] |
getCurrentValue()
Returns the contents of the current value being referenced, or null
otherwise.
|
protected void |
handleNoSuchElement()
Called right before throwing NoSuchElementException.
|
boolean |
hasNext()
Returns true if this cursor has more elements.
|
protected abstract S |
instantiateCurrent()
Returns a new Storable instance for the currently referenced entry.
|
S |
next()
Returns the next element from this cursor.
|
protected abstract void |
release()
Release any internal resources, called when closed.
|
int |
skipNext(int amount)
Skips forward by the specified amount of elements, returning the actual
amount skipped.
|
protected abstract boolean |
toFirst()
Move the cursor to the first available entry.
|
protected abstract boolean |
toFirst(byte[] key)
Move the cursor to the first available entry at or after the given
key.
|
protected abstract boolean |
toLast()
Move the cursor to the last available entry.
|
protected abstract boolean |
toLast(byte[] key)
Move the cursor to the last available entry at or before the given
key.
|
protected abstract boolean |
toNext()
Move the cursor to the next available entry, returning false if none.
|
protected int |
toNext(int amount)
Move the cursor to the next available entry, incrementing by the amount
given.
|
protected boolean |
toNextKey()
Move the cursor to the next unique key, returning false if none.
|
protected abstract boolean |
toPrevious()
Move the cursor to the previous available entry, returning false if
none.
|
protected int |
toPrevious(int amount)
Move the cursor to the previous available entry, decrementing by the
amount given.
|
protected boolean |
toPreviousKey()
Move the cursor to the previous unique key, returning false if none.
|
copyInto, copyInto, toList, toListprotected final java.util.concurrent.locks.Lock mLock
protected RawCursor(java.util.concurrent.locks.Lock lock,
byte[] startBound,
boolean inclusiveStart,
byte[] endBound,
boolean inclusiveEnd,
int maxPrefix,
boolean reverse)
lock - operations lock on this objectstartBound - specify the starting key for the cursor, or null if firstinclusiveStart - true if start bound is inclusiveendBound - specify the ending key for the cursor, or null if lastinclusiveEnd - true if end bound is inclusivemaxPrefix - maximum expected common initial bytes in start and end boundreverse - when true, iteration is reversedjava.lang.IllegalArgumentException - if any bound is null but is not inclusivepublic void close()
throws FetchException
CursorFetchExceptionpublic boolean hasNext()
throws FetchException
Cursornext would return an element rather than throwing
an exception.FetchException - if storage layer throws an exceptionpublic S next() throws FetchException, java.util.NoSuchElementException
CursorFetchException - if storage layer throws an exceptionjava.util.NoSuchElementException - if the cursor has no next element.public int skipNext(int amount)
throws FetchException
CursorskipNext in interface Cursor<S>skipNext in class AbstractCursor<S>amount - maximum amount of elements to skipFetchException - if storage layer throws an exceptionprotected abstract void release()
throws FetchException
FetchExceptionprotected abstract byte[] getCurrentKey()
throws FetchException
If cursor is not opened, null must be returned.
java.lang.IllegalStateException - if key is disabledFetchExceptionprotected abstract byte[] getCurrentValue()
throws FetchException
If cursor is not opened, null must be returned.
java.lang.IllegalStateException - if value is disabledFetchExceptionprotected void disableKeyAndValue()
protected void disableValue()
protected void enableKeyAndValue()
throws FetchException
FetchExceptionprotected abstract S instantiateCurrent() throws FetchException
java.lang.IllegalStateException - if no current entry to instantiateFetchExceptionprotected abstract boolean toFirst()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected abstract boolean toFirst(byte[] key)
throws FetchException
key - key to search forjava.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected abstract boolean toLast()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected abstract boolean toLast(byte[] key)
throws FetchException
key - key to search forjava.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected abstract boolean toNext()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected int toNext(int amount)
throws FetchException
Calling to toNext(1) is equivalent to calling toNext().
amount - positive amount to advancejava.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected boolean toNextKey()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected abstract boolean toPrevious()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected int toPrevious(int amount)
throws FetchException
Calling to toPrevious(1) is equivalent to calling toPrevious().
amount - positive amount to retreatjava.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected boolean toPreviousKey()
throws FetchException
java.lang.IllegalStateException - if cursor is not openedFetchExceptionprotected int compareKeysPartially(byte[] key1,
byte[] key2)
protected void handleNoSuchElement()
throws FetchException
FetchExceptionCopyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.