I have a native process (written in c) which generates an unknown number of
bytes (jpeg images), and I would like to find an efficient way of
transferring these bytes from native to java, the end goal being a java
BufferedImage.
The overall process is run from java, and the native part is started through
a jni method call.
One idea that I have is to create a PipedOutputStream, pass it to the native
code, let the native code write its output into it, and then, in java, read
the bytes from the connected PipedInputStream.
Would this work? Or are there better alternatives in java.nio (channels,
direct buffers...) or elsewhere?
Any suggestions would be appreciated.
/Mats Olsson