|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.converters.resultset.ResultSetConverter
A class to convert the contents of java.sql.ResultSet
objects
into blocks of data. An instance of this class is constructed using the
java.sql.ResultSet
to be converted and a
ResultSetHandler
to handle the events that are dispatched
during the process. Depending on the type of ResultSetHandler
that is used, different serialisations can be produced.
ResultSetHandler
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement. |
private java.lang.StringBuffer |
mBlock
The string buffer that holds the next block of data to be returned. |
private boolean |
mFooter
Flag used to track whether the footer has been handled. |
private ResultSetHandler |
mHandler
The handler for converting different parts of the result set. |
private boolean |
mHeader
Flag used to track whether the header has been handled. |
private java.sql.ResultSet |
mResultSet
The result set that is being converted into blocks. |
Constructor Summary | |
ResultSetConverter(java.sql.ResultSet results,
ResultSetHandler handler)
Creates a new ResultSetConverter . |
Method Summary | |
protected java.lang.StringBuffer |
createStringBuffer()
Creates and returns a string buffer used for storing the string representation of the next block of data. |
boolean |
hasNext()
Indicates whether or not there are any more blocks of data to be read. |
java.lang.String |
next()
Gets the next block of converted data. |
private void |
processNextBlock()
Generates the next block of data from the result set and saves a reference to it using mBlock . |
private void |
processRow(java.lang.StringBuffer strbuf)
Processes the current row of the result set, adding the converted data to the string buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private final java.sql.ResultSet mResultSet
private final ResultSetHandler mHandler
private java.lang.StringBuffer mBlock
private boolean mHeader
private boolean mFooter
Constructor Detail |
public ResultSetConverter(java.sql.ResultSet results, ResultSetHandler handler)
ResultSetConverter
.
results
- result set to converthandler
- handler to use for converting the result set
java.lang.IllegalArgumentException
- if results
or
handler
are null
.Method Detail |
public boolean hasNext() throws ResultSetHandlerException
true
if there are, false
otherwise.
ResultSetHandlerException
- If a problem occurs when accessing the ResultSet.public java.lang.String next() throws ResultSetHandlerException
String
representing data
java.util.NoSuchElementException
- If there are no more blocks of data.
ResultSetHandlerException
- If a problem occurs when accessing the ResultSet.private void processNextBlock() throws ResultSetHandlerException
mBlock
. If there are no more blocks
then the reference is set to null
.
ResultSetHandlerException
- If a problem occurs when accessing the ResultSet.private void processRow(java.lang.StringBuffer strbuf) throws ResultSetHandlerException
ResultSetHandlerException
- If a problem occurs when accessing the ResultSet or
writing data to the byte stream.protected java.lang.StringBuffer createStringBuffer()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |