The single-argument readMetadata() takes a file; there is a two-argument that takes a *Buffered*InputStream and a boolean. You could wrap your ByteArrayInputStream in a BufferedInputStream and decide whether you want to 'waitForBytes', whatever that means...
Coerce a ByteArrayInputStream to InputStream
-
29-05-2022 - |
質問
I have some code that does:
content = Java::byte[s].new
f = tar.read(content, 0, s)
content_stream = ByteArrayInputStream.new(content)
So far, so good
But when I try to use a method that only takes an InputStream, like so:
metadata = ImageMetadataReader.readMetadata(content_stream)
I get the following exception:
NameError: no method 'readMetadata' for arguments (java.io.ByteArrayInputStream) on Java::ComDrewImaging::ImageMetadataReader
I've tried using content_stream.to_java(java.io.InputStream)
and that still generates the same error. Any ideas?
解決
他のヒント
It's because readMetadata has 2 signatures, one with one argument: a java.io.File and a second which you try to use that takes 2 arguments a ByteArrayInputStream and a boolean. Try to replace your code with ImageMetadataReader.readMetadata(content_stream, false)
所属していません StackOverflow