1

我正在调用一个接受的方法InputStream。这是github上的方法:https ://github.com/drewnoakes/metadata-extractor/blob/2.8.0/Source/com/drew/imaging/ImageMetadataReader.java#L89

我正在调用BufferedInputStream应该可以使用的方法,因为它是一个子对象,InputStream但我不断收到此错误:

No signature of method: static com.drew.imaging.ImageMetadataReader.readMetadata() is applicable for argument types: (java.io.BufferedInputStream) values: [java.io.BufferedInputStream@74d4ec5f]
Possible solutions: readMetadata(java.io.File), readMetadata(java.io.BufferedInputStream, boolean). Stacktrace follows:
Message: No signature of method: static com.drew.imaging.ImageMetadataReader.readMetadata() is applicable for argument types: (java.io.BufferedInputStream) values: [java.io.BufferedInputStream@74d4ec5f]
Possible solutions: readMetadata(java.io.File), readMetadata(java.io.BufferedInputStream, boolean)
    Line | Method
->>  137 | settings  in com.foo.scanner.AdminController
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    198 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|     53 | doFilter  in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|     62 | doFilter  in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|     59 | doFilter  in grails.plugin.springsecurity.web.SecurityRequestHolderFilter

这是我的代码:

println file62.name //prints name of the file
println file62.inputStream.getClass() //prints java.io.BufferedInputStream
InputStream is = (InputStream)file62.inputStream
Metadata metadata = com.drew.imaging.ImageMetadataReader.readMetadata(is) //readMetadata expects InputStream

我拥有的库版本:

✗ grails dependency-report | grep "drew" +--- com.drewnoakes:metadata-extractor:2.9.1 +--- com.drewnoakes:metadata-extractor:2.9.1 +--- com.drewnoakes:metadata-extractor:2.9.1

这是 2.9.1 中的方法:https ://github.com/drewnoakes/metadata-extractor/blob/2.9.1/Source/com/drew/imaging/ImageMetadataReader.java#L88

4

2 回答 2

3

异常表示该方法需要 aFile或 aBufferedInputStream 一个布尔值。没有重载只需要一个BufferedInputStream.

如果您确定形参和实参匹配,那么这种异常(由形参不匹配引起)的最可能原因是周围有一个旧罐子。运行mvn clean, gradle clean,检查你的 web 容器的 lib 目录,并且通常从你的系统中消除错误的 jars。

于 2016-10-25T21:24:00.553 回答
0

@PaulHicks 完全正确。早在 2012 年,您调用的 API 就被误导并以极端偏见的方式被删除,这次提交是:

https://github.com/drewnoakes/metadata-extractor/commit/9f3854b81313f1ea498b991d36253f221db79dca#diff-8fa1b864bada9112be69ec00784af715

GitHub 建议在 2.7.0 版中删除 API。

于 2016-10-27T08:25:40.280 回答