I have a JNI function "byte[] read()" which reads some bytes from a particular hardware interface and returns a new byte array each time it is called. The read data is always ASCII text data and has '\n' for line termination.
I'd like to convert these MULTIPLE byte arrays read from the function into an InputStream so I may print them line by line.
Something like:
while(running) {
byte[] in = read(); // Can very well return in complete line
SomeInputStream.setMoreIncoming(in);
if(SomeInputStream.hasLineData())
System.out.println(SomeInputSream.readline());
}
How do I do that?