に変換しInputStream
てBufferedImage
いるときに、次のエラーが表示されます
byte[] imgBytes = decoder.decode(encodedStr);
この行は正常に実行され、バイト配列が適切に生成されています
InputStream in = new ByteArrayInputStream(imgBytes);
BufferedImage bImageFromConvert = ImageIO.read(in);
この行はInputStream
正しく読み取ることができないため、エラーが発生しています
Below is the error
javax.imageio.IIOException: Error reading PNG image data
at com.sun.imageio.plugins.png.PNGImageReader.readImage(Unknown Source)
at com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at DecodeSignatureFile.generateImage(DecodeSignatureFile.java:252)
at DecodeSignatureFile.getContents(DecodeSignatureFile.java:176)
at DecodeSignatureFile.process(DecodeSignatureFile.java:322)
at DecodeSignatureFile.main(DecodeSignatureFile.java:334)
Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.readFully(Unknown Source)
at com.sun.imageio.plugins.png.PNGImageReader.decodePass(Unknown Source)
at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(Unknown Source)
... 8 more