Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19066
  • 博文数量: 8
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 100
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-03 14:09
文章分类

全部博文(8)

文章存档

2010年(7)

2009年(1)

我的朋友

分类: Java

2010-03-02 09:12:28

public static int getTIFFPageNum(String srcPath) {
  File srcFile = new File(srcPath);
  InputStream fis = null;
  try {
   fis = new FileInputStream(srcFile);
   TIFFDecodeParam decodeParam = new TIFFDecodeParam();
   ImageDecoder decoder = ImageCodec.createImageDecoder("TIFF", fis,
     decodeParam);
   return decoder.getNumPages();
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   try {
    if (null != fis) {
     fis.close();
    }
   } catch (Exception e) {
   }
  }
  return 0;
 }
阅读(712) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~