我正在调用一个接受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
答案 0 :(得分:3)
例外情况表明该方法需要File
或BufferedInputStream
和布尔值。没有任何重载需要 BufferedInputStream
。
如果您确定形式参数和实际参数匹配,那么这种异常(由正式参数不匹配引起)的最可能原因是周围有一个旧罐子。运行mvn clean
,gradle clean
,检查您的Web容器的lib目录,并通常从系统中删除错误的jar。
答案 1 :(得分:0)
GitHub建议在2.7.0版本中删除API。