|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CloseableIterator<T>
Extension to Iterator to provide a close() method. This should be in the JDK.
NOTE: You must call close()
method when you are done otherwise the underlying SQL
statement and connection may be kept open.
Method Summary | |
---|---|
void |
close()
Close any underlying SQL statements. |
T |
current()
Return the current result object that we have accessed or null if none. |
T |
first()
Move to the first result and return it or null if none. |
DatabaseResults |
getRawResults()
Return the underlying database results object if any. |
T |
moveRelative(int offset)
Move a relative position in the list and return that result or null if none. |
void |
moveToNext()
Move to the next item in the iterator without calling Iterator.next() . |
T |
nextThrow()
Returns the Iterator.next() object in the table or null if none. |
T |
previous()
Moves to the previous result and return it or null if none. |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Method Detail |
---|
void close() throws SQLException
SQLException
DatabaseResults getRawResults()
void moveToNext()
Iterator.next()
.
T first() throws SQLException
SQLException
T previous() throws SQLException
SQLException
T current() throws SQLException
SQLException
T nextThrow() throws SQLException
Iterator.next()
object in the table or null if none.
SQLException
- Throws a SQLException on error since Iterator.next()
cannot throw because it is part of the
Iterator
definition. It will not throw if there is no next.T moveRelative(int offset) throws SQLException
Iterator.next()
.
moveRelative(-1) is the same as previous()
result. This may not work with the default iterator depending
on your database.
offset
- Number of rows to move. Positive moves forward in the results. Negative moves backwards.
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |