|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.cursor.AbstractCursor<S>
public abstract class AbstractCursor<S>
AbstractCursor implements a small set of common Cursor methods.
| Constructor Summary | |
|---|---|
protected |
AbstractCursor()
|
| Method Summary | |
|---|---|
int |
copyInto(Collection<? super S> c)
Copies all remaining next elements into the given collection. |
int |
copyInto(Collection<? super S> c,
int limit)
Copies a limited amount of remaining next elements into the given collection. |
int |
skipNext(int amount)
Skips forward by the specified amount of elements, returning the actual amount skipped. |
List<S> |
toList()
Copies all remaining next elements into a new modifiable list. |
List<S> |
toList(int limit)
Copies a limited amount of remaining next elements into a new modifiable list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.amazon.carbonado.Cursor |
|---|
close, hasNext, next |
| Constructor Detail |
|---|
protected AbstractCursor()
| Method Detail |
|---|
public int copyInto(Collection<? super S> c)
throws FetchException
Cursor
Cursor cursor;
...
while (cursor.hasNext()) {
c.add(cursor.next());
}
As a side-effect of calling this method, the cursor is closed.
copyInto in interface Cursor<S>FetchException - if storage layer throws an exception
public int copyInto(Collection<? super S> c,
int limit)
throws FetchException
Cursor
Cursor cursor;
...
while (--limit >= 0 && cursor.hasNext()) {
c.add(cursor.next());
}
copyInto in interface Cursor<S>limit - maximum amount of elements to copy
FetchException - if storage layer throws an exception
public List<S> toList()
throws FetchException
CursorCursor<S> cursor; ... List<S> list = new ... cursor.copyInto(list);
As a side-effect of calling this method, the cursor is closed.
toList in interface Cursor<S>FetchException - if storage layer throws an exception
public List<S> toList(int limit)
throws FetchException
CursorCursor<S> cursor; ... List<S> list = new ... cursor.copyInto(list, limit);
toList in interface Cursor<S>limit - maximum amount of elements to copy
FetchException - if storage layer throws an exception
public int skipNext(int amount)
throws FetchException
Cursor
skipNext in interface Cursor<S>amount - maximum amount of elements to skip
FetchException - if storage layer throws an exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||