将InputStream读入文件时,ZLIB输入流意外结束

时间:2014-11-12 15:49:58

标签: groovy apache-poi powerpoint

我试图将InputStream放入文件并获取以下堆栈跟踪:

org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException: Listener method 'handleMessage' threw exception
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.UndeclaredThrowableException
    ... 1 more
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
    at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240)
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)

以下是导致它的代码段

HSLFSlideShow ppt = new HSLFSlideShow(fs)
ObjectData[] embeddes = ppt.getEmbeddedObjects()
embeddes.eachWithIndex { ObjectData entry, int i ->
  File f = new File (fileToSave)
  f.withOutputStream { w -> 
     w << entry.getData() //This causes the error
  }
}

以下是ObjectDatagetData()方法https://poi.apache.org/apidocs/org/apache/poi/hslf/usermodel/ObjectData.html#getData()

的链接

我正在使用Apache POI 3.10-FINAL

0 个答案:

没有答案