本文整理汇总了Java中org.eclipse.birt.report.engine.api.IRenderOption.setOutputStream方法的典型用法代码示例。如果您正苦于以下问题:Java IRenderOption.setOutputStream方法的具体用法?Java IRenderOption.setOutputStream怎么用?Java IRenderOption.setOutputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.birt.report.engine.api.IRenderOption
的用法示例。
在下文中一共展示了IRenderOption.setOutputStream方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRenderAll
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderAll( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
assertTrue( renderTask.getErrors( ).isEmpty( ) );
renderTask.close( );
String pageContent = out.toString( "UTF-8" );
assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
document.close( );
}
示例2: doRenderAll
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderAll( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
assertTrue( renderTask.getErrors( ).isEmpty( ) );
renderTask.close( );
String pageContent = out.toString( "UTF-8" );
assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
document.close( );
}
示例3: test90378
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
public void test90378( ) throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( "html" );
option.setOutputStream( out );
render( "org/eclipse/birt/report/engine/regression/90378.rptdesign",
option );
String report = out.toString( );
Pattern pattern = Pattern.compile( "<div>b1</div>" );
Matcher matcher = pattern.matcher( report );
int matches = 0;
while ( matcher.find( ) )
{
matches++;
}
assertEquals( 2, matches );
}
示例4: findIID
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private ArrayList findIID( String doc, String type )
throws EngineException, UnsupportedEncodingException
{
ArrayList iids = new ArrayList( );
IRenderTask task = null;
IReportDocument reportDoc = null;
reportDoc = engine.openReportDocument( doc );
task = engine.createRenderTask( reportDoc );
IRenderOption htmlRenderOptions = new HTMLRenderOption( );
HashMap appContext = new HashMap( );
task.setAppContext( appContext );
ByteArrayOutputStream ostream = new ByteArrayOutputStream( );
htmlRenderOptions.setOutputStream( ostream );
htmlRenderOptions.setOutputFormat( "html" );
( (HTMLRenderOption) htmlRenderOptions ).setEnableMetadata( true );
task.setRenderOption( htmlRenderOptions );
task.render( );
task.close( );
String content = ostream.toString( "utf-8" );
Pattern typePattern = buildPattern(type);
Matcher matcher = typePattern.matcher( content );
while ( matcher.find( ) )
{
String tmp_type = null, strIid = null;
tmp_type = matcher.group( 0 );
strIid = tmp_type.substring( tmp_type.indexOf( "iid" ) );
strIid = strIid.substring( 5, strIid.indexOf( "\"", 6 ) );
iids.add( InstanceID.parse( strIid ) );
}
return iids;
}
示例5: ivRenderDocument
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
protected String ivRenderDocument( String document, String reportlet )
throws EngineException, IOException
{
IArchiveFile av = archiveFactory.openArchive( document, "r" );
try
{
IReportDocument reportDocument = engine.openReportDocument(
document, new ArchiveReader( av ), new HashMap( ) );
try
{
IRenderTask renderTask = engine
.createRenderTask( reportDocument );
try
{
renderTask.setReportlet( reportlet );
IRenderOption option = new RenderOption( );
option.setOutputFormat( IRenderOption.OUTPUT_FORMAT_HTML );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
return new String( out.toByteArray( ) );
}
finally
{
renderTask.close( );
}
}
finally
{
reportDocument.close( );
}
}
finally
{
av.close( );
}
}
示例6: doRenderPages
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderPages( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
long totalPage = document.getPageCount( );
assertEquals( 2, totalPage );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
for ( long pageNumber = 1; pageNumber <= totalPage; pageNumber++ )
{
IRenderTask renderTask = engine.createRenderTask( document );
renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.setPageNumber( pageNumber );
renderTask.render( );
assertTrue( renderTask.getErrors( ).isEmpty( ) );
renderTask.close( );
String pageContent = out.toString( "UTF-8" );
if ( pageNumber == 1 )
{
assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) == -1 );
}
else
{
assertTrue( pageContent.indexOf( "reportlet_table" ) == -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
}
out.reset( );
}
document.close( );
}
示例7: doRenderPages
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderPages( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
long totalPage = document.getPageCount( );
assertEquals( 2, totalPage );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
for ( long pageNumber = 1; pageNumber <= totalPage; pageNumber++ )
{
IRenderTask renderTask = engine.createRenderTask( document );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.setPageNumber( pageNumber );
renderTask.render( );
assertTrue( renderTask.getErrors( ).isEmpty( ) );
renderTask.close( );
String pageContent = out.toString( "UTF-8" );
if ( pageNumber == 1 )
{
assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) == -1 );
}
else
{
assertTrue( pageContent.indexOf( "reportlet_table" ) == -1 );
assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
}
out.reset( );
}
document.close( );
}
示例8: testRunRenderCancelOnError
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
public void testRunRenderCancelOnError( )
{
String input = this.genInputFile( inputName );
int cancelSize = 0, continueSize = 0;
try
{
IReportRunnable runnable = engine
.openReportDesign( new FileInputStream( new File( input ) ) );
IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );
// continue on error
IRenderOption options = new RenderOption( );
ByteArrayOutputStream baos = new ByteArrayOutputStream( );
options.setOutputStream( baos );
task.setRenderOption( options );
task.setErrorHandlingOption( IEngineTask.CONTINUE_ON_ERROR );
task.run( );
task.close( );
continueSize = baos.size( );
baos.reset( );
// cancel on error
task = engine.createRunAndRenderTask( runnable );
task.setRenderOption( options );
task.setErrorHandlingOption( IEngineTask.CANCEL_ON_ERROR );
task.run( );
task.close( );
cancelSize = baos.size( );
baos.reset( );
baos.close( );
assertTrue( continueSize > cancelSize );
}
catch ( Exception e )
{
e.printStackTrace( );
fail( );
}
}
示例9: findIid
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private InstanceID findIid( String fileName, String type )
{
InstanceID iid = null;
report_document = outputPath + fileName + ".rptdocument";
report_design = inputPath + fileName + ".rptdesign";
copyResource_INPUT( fileName + ".rptdesign", fileName + ".rptdesign" );
IRenderTask task;
try
{
createReportDocument( report_design, report_document );
reportDoc = engine.openReportDocument( report_document );
task = engine.createRenderTask( reportDoc );
task.setLocale( Locale.ENGLISH );
IRenderOption htmlRenderOptions = new HTMLRenderOption( );
HashMap appContext = new HashMap( );
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory( outputPath + "image" );
appContext.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext );
task.setAppContext( appContext );
ByteArrayOutputStream ostream = new ByteArrayOutputStream( );
htmlRenderOptions.setOutputStream( ostream );
htmlRenderOptions.setOutputFormat( "html" );
( (HTMLRenderOption) htmlRenderOptions ).setEnableMetadata( true );
task.setRenderOption( htmlRenderOptions );
task.render( );
task.close( );
String content = ostream.toString( "utf-8" );
Pattern typePattern = DataExtractionTaskTest.buildPattern( type );
Matcher matcher = typePattern.matcher( content );
if ( matcher.find( ) )
{
String tmp_type = matcher.group( 1 ), strIid;
strIid = tmp_type.substring( tmp_type.indexOf( "iid" ) );
strIid = strIid.substring( 5, strIid.indexOf( "\"", 6 ) );
iid = InstanceID.parse( strIid );
return iid;
}
}
catch ( Exception e )
{
e.printStackTrace( );
assertFalse( "Failed to find instance id of " + type, true );
}
return iid;
}
示例10: doDataExtractionWithInstanceID
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doDataExtractionWithInstanceID( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
renderTask.close( );
String content = out.toString( "UTF-8" );
Pattern iidPattern = Pattern.compile( "iid=\"([^\"]*)\"" );
Matcher matcher = iidPattern.matcher( content );
while ( matcher.find( ) )
{
String strIid = matcher.group( 1 );
InstanceID iid = InstanceID.parse( strIid );
long designId = iid.getComponentID( );
IReportRunnable runnable = renderTask.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle
|| element instanceof ListHandle )
{
IDataExtractionTask task = engine
.createDataExtractionTask( document );
task.setInstanceID( iid );
IExtractionResults results = task.extract( );
if ( element instanceof TableHandle )
{
assertEquals( 27, getFieldCount( results ) );
}
else
{
assertEquals( 6, getFieldCount( results ) );
}
task.close( );
}
}
document.close( );
}
示例11: doDataExtractionWithInstanceID
import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doDataExtractionWithInstanceID( ) throws Exception
{
IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
ByteArrayOutputStream out = new ByteArrayOutputStream( );
IRenderTask renderTask = engine.createRenderTask( document );
IRenderOption option = new HTMLRenderOption( );
option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
option.setOutputStream( out );
renderTask.setRenderOption( option );
renderTask.render( );
renderTask.close( );
String content = out.toString( "UTF-8" );
Pattern iidPattern = Pattern.compile( "iid=\"([^\"]*)\"" );
Matcher matcher = iidPattern.matcher( content );
while ( matcher.find( ) )
{
String strIid = matcher.group( 1 );
InstanceID iid = InstanceID.parse( strIid );
long designId = iid.getComponentID( );
IReportRunnable runnable = renderTask.getReportRunnable( );
ReportDesignHandle report = (ReportDesignHandle) runnable
.getDesignHandle( );
DesignElementHandle element = report.getElementByID( designId );
if ( element instanceof TableHandle
|| element instanceof ListHandle )
{
IDataExtractionTask task = engine
.createDataExtractionTask( document );
task.setInstanceID( iid );
IExtractionResults results = task.extract( );
if ( element instanceof TableHandle )
{
assertEquals( 27, getFieldCount( results ) );
}
else
{
assertEquals( 6, getFieldCount( results ) );
}
task.close( );
}
}
document.close( );
}