XChinux's Home

过往资料可到百度空间http://hi.baidu.com/xchinux

http://www.qtcn.org/bbs/u/2  [收藏] [复制]

XChinux

爱Qt,爱N9,qtcn.org

  • 632

    关注

  • 2178

    粉丝

  • 6397

    访客

  • 等级:光明使者
  • 身份:总版主
  • 总积分:11224
  • 男,1979-01-01
  • 山西

最后登录:2024-01-27

更多资料

日志

Java编程调用FOP转换

2011-06-12 12:50

2008-12-06  17:51
     public boolean fop(String[] args)
     {
         boolean bRet = true;
         CommandLineOptions options = null;
         FOUserAgent foUserAgent = null;
         OutputStream out = null;

         try
         {
             options = new CommandLineOptions();
             options.parse(args);
            
             foUserAgent = options.getFOUserAgent();
             String outputFormat = options.getOutputFormat();

             try
             {
                 if (options.getOutputFile() != null)
                 {
                     out = new java.io.BufferedOutputStream(
                             new java.io.FileOutputStream(
                                 options.getOutputFile()));
                     foUserAgent.setOutputFile(options.getOutputFile());
                 }
                 if (!MimeConstants.MIME_XSL_FO.equals(outputFormat))
                 {
                     options.getInputHandler().renderTo(foUserAgent,
                             outputFormat, out);
                 }
                 else
                 {
                     options.getInputHandler().transformTo(out);
                 }
              }
              finally
              {
                  IOUtils.closeQuietly(out);
              }
         }
         catch (Exception e)
         {
             if (options != null)
             {
                 //options.getLogger().error("Exception", e);
             }
             if (options.getOutputFile() != null)
             {
                 options.getOutputFile().delete();
             }
             bRet = false;
         }
         return bRet;
     }
分类:编程技术|回复:0|浏览:1486|全站可见|转载
 

Powered by phpwind v8.7 Certificate Copyright Time now is:04-26 01:49
©2005-2016 QTCN开发网 版权所有 Gzip disabled