My java program is an interface to a C program which it calls with Runtime.Exec(). So I have the C program as process p. I wrap p.inputstream() with an ImageInputStream. The C program outputs some text data, then outputs the length of the upcoming jpeg and then outputs the jpeg as binary, outputs more text data, another jpeg, text, jpeg, etc. In the java program, I read the C prog's output text with some regular expressions, then I get the length of the jpeg and do:
It works fine on my Linux machine. But on Windows XP I get the runtime error: Premature end of jpeg file sun.awt.image.ImageFormatException: JPEG datastream contains no image at sun.awt.image.JPEGImageDecoder.readImage (Native Method) at sun.awt.image.JPEGImageDecoder.produceImage at sun.awt.image.InputStreamImageSourcce.doFetch at sun.awt.image.Imagefetcher.fetchloop at sun.awt.image.Imagefetcher.run All suggestions on how to fix this are welcome. Thanks.
Joined: Feb 24, 2004
I forgot to add that the error actually comes when I try to change the currFrame to a bufferedImage.