try {
IPentahoMetaData metadata = getMetaData();
Object[][] columnHeaders = metadata.getColumnHeaders();
Object[][] rowHeaders = metadata.getRowHeaders();
MemoryMetaData cachedMetaData = new MemoryMetaData( columnHeaders, rowHeaders );
MemoryResultSet cachedResultSet = new MemoryResultSet( cachedMetaData );
Object[] rowObjects = next();
while ( rowObjects != null ) {
cachedResultSet.addRow( rowObjects );