I have a function, int readFully(FileHandle handle, OutputStream out)
, which reads in an entire file from an SSH server and stores it in a local stream. I can write the file locally by using a FileOutputStream
for the second parameter and then read that file into a BufferedImage
using something like this:
bufferedImage = ImageIO.read(new File("/path/to/file"));
But how can I create the bufferedImage directly without first writing it to a file? I looked at this question, but still can't figure it out for my case.
FileHandle
class in the parameter? If you can get anInputStream
from it, then you can useImageIO.read(InputStream input)
method.FileHandle
class holds some basic properties of the file, e.g. filename, path, permissions, etc. It doesn't have much functionality and I can't get an InputStream from it.