3

入力がInputStreamあり、これを読みたいInputStream

私は

BufferedImage image = null;

そして、私は次のように読みましたImageIO

read image = ImageIO.read(input);

このコードは JPEG および JPG ファイルで機能しますが、PNG ファイルでは次のエラーが発生します。

javax.imageio.IIOException: Error reading PNG image data    at
com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1308)
    at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1577)
    at javax.imageio.ImageIO.read(ImageIO.java:1448)    at
javax.imageio.ImageIO.read(ImageIO.java:1352)   at
org.projectsforge.swap.proxy.simulation.DichromacyImageSimulation.handle(DichromacyImageSimulation.java:64)
    at org.projectsforge.swap.proxy.proxy.ProxyServlet$1.execute(ProxyServlet.java:150)
    at org.projectsforge.swap.proxy.proxy.ProxyServlet$1.execute(ProxyServlet.java:1)
    at org.projectsforge.swap.core.handlers.HandlerExecutorManager.execute(HandlerExecutorManager.java:72)
    at org.projectsforge.swap.core.handlers.HandlerContext$1.run(HandlerContext.java:175)
Caused by: java.util.zip.ZipException: invalid distance too far back
    at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)   
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)  
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)   
at java.io.DataInputStream.readFully(DataInputStream.java:195)  
at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1092)
at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1207)
at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1301)
    ... 8 more

特にこのエラーは毎回発生するわけではないため、このエラーがわかりません...

4

0 に答える 0