net.sf.jasperreports.engine
Class JRResultSetDataSource

java.lang.Object
  extended by net.sf.jasperreports.engine.JRResultSetDataSource
All Implemented Interfaces:
JRDataSource

public class JRResultSetDataSource
extends java.lang.Object
implements JRDataSource

An implementation of a data source that uses a supplied ResultSet.

Version:
$Id: JRResultSetDataSource.java 3939 2010-08-20 09:52:00Z teodord $
Author:
Teodor Danciu ([email protected])

Constructor Summary
JRResultSetDataSource(java.sql.ResultSet rs)
           
 
Method Summary
protected  java.lang.String clobToString(java.sql.Clob clob)
           
protected  java.io.CharArrayReader getArrayReader(java.io.Reader reader, long size)
           
 java.lang.Object getFieldValue(JRField field)
          Gets the field value for the current position.
 boolean next()
          Tries to position the cursor on the next element in the data source.
protected  byte[] readBytes(java.io.InputStream is, long size)
           
protected  byte[] readBytes(java.lang.Integer columnIndex)
           
protected  java.lang.Integer searchColumnByLabel(java.lang.String fieldName)
           
protected  java.lang.Integer searchColumnByName(java.lang.String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRResultSetDataSource

public JRResultSetDataSource(java.sql.ResultSet rs)
Method Detail

next

public boolean next()
             throws JRException
Description copied from interface: JRDataSource
Tries to position the cursor on the next element in the data source.

Specified by:
next in interface JRDataSource
Returns:
true if there is a next record, false otherwise
Throws:
JRException - if any error occurs while trying to move to the next element

getFieldValue

public java.lang.Object getFieldValue(JRField field)
                               throws JRException
Description copied from interface: JRDataSource
Gets the field value for the current position.

Specified by:
getFieldValue in interface JRDataSource
Returns:
an object containing the field value. The object type must be the field object type.
Throws:
JRException

searchColumnByName

protected java.lang.Integer searchColumnByName(java.lang.String fieldName)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

searchColumnByLabel

protected java.lang.Integer searchColumnByLabel(java.lang.String fieldName)
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

clobToString

protected java.lang.String clobToString(java.sql.Clob clob)
                                 throws JRException
Throws:
JRException

getArrayReader

protected java.io.CharArrayReader getArrayReader(java.io.Reader reader,
                                                 long size)
                                          throws java.io.IOException
Throws:
java.io.IOException

readBytes

protected byte[] readBytes(java.lang.Integer columnIndex)
                    throws java.sql.SQLException,
                           java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

readBytes

protected byte[] readBytes(java.io.InputStream is,
                           long size)
                    throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.