保存源码位置
Metadata metadata = ImageMetadataReader.readMetadata (bin );
错误信息
com.drew.lang.BufferBoundsException: Attempt to read from beyond end of underlying data source (requested index: 6, requested count: 2, max index: 5 )
at com.drew.lang.ByteArrayReader.validateIndex (ByteArrayReader.java:68 )
at com.drew.lang.RandomAccessReader.getInt16 (RandomAccessReader.java:205 )
at com.drew.imaging.tiff.TiffReader.processTiff (TiffReader.java:53 )
at com.drew.metadata.exif.ExifReader.extract (ExifReader.java:88 )
at com.drew.metadata.exif.ExifReader.readJpegSegments (ExifReader.java:73 )
at com.drew.imaging.jpeg.JpegMetadataReader.processJpegSegmentData (JpegMetadataReader.java:126 )
at com.drew.imaging.jpeg.JpegMetadataReader.process (JpegMetadataReader.java:118 )
at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata (JpegMetadataReader.java:69 )
at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata (JpegMetadataReader.java:76 )
at com.drew.imaging.ImageMetadataReader.readMetadata (ImageMetadataReader.java:98 )
用catch (Exception e )
尝试过无法捕获
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.8.1</version>
</dependency>
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.