File parent = file.getParentFile( ); if ( parent != null && !parent.exists( ) ) { parent.mkdirs( ); }
	public void initialize(IEmitterServices services)	{		//get the output file name from RenderOptionBase.OUTPUT_FILE_NAME.		//It has the top preference.		this.reportRunnable = services.getReportRunnable();		if (reportRunnable != null)		{			reportDesign = (ReportDesignHandle)reportRunnable.getDesignHandle();		}		Object renderContext = services.getRenderContext();		if(renderContext!=null && renderContext instanceof Map)		{			Object con = ((Map)renderContext).get(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT);			if(con instanceof PDFRenderContext)			{				this.context = (PDFRenderContext)con;			}		}		Object fd = services.getOption( RenderOptionBase.OUTPUT_FILE_NAME );		File file = null;		try		{			if( fd != null )			{				file = new File(fd.toString());				output = new FileOutputStream( file );			}		}		catch( FileNotFoundException fnfe )		{			logger.log( Level.WARNING, fnfe.getMessage( ), fnfe );		}				//while failed to get the outputStream from the output file name specified		//from RenderOptionBase.OUTPUT_FILE_NAME, use RenderOptionBase.OUTPUT_STREAM		//to build the outputStream		if( output == null )		{			Object value = services.getOption( RenderOptionBase.OUTPUT_STREAM );			if( value != null && value instanceof OutputStream )			{				output = ( OutputStream ) value;			}						//if the RenderOptionBase.OUTPUT_STREAM is NOT set, build the outputStream from the			//REPORT_FILE param defined in this file.			else			{				try				{					file = new File( REPORT_FILE );					output = new FileOutputStream( file );				}				catch ( FileNotFoundException e )				{					logger.log(Level.SEVERE, e.getMessage( ), e );				}			}		}	}