[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Problem sending image as stream
|
Please open a bug report. This should work.
Thanks,
Carolyn
"Mark McLaren" <mark.k.mclaren@xxxxxxxxx> wrote in message
news:f32ce20493b595a39c02b25f781d5532$1@xxxxxxxxxxxxxxxxxx
>I need to send an image over a network as well as some other data, but
>ImageLoader doesn't behave as I would expect. Here's a JUnit test case
>showing the problem (using 3.4-M6a):
>
> public void testCanWriteAndReadBlankPic() throws Exception {
> ImageData outImg = new ImageData(200, 200, 24, new PaletteData(0, 0, 0));
> ByteArrayOutputStream outStream = new ByteArrayOutputStream();
> ImageLoader outLoader = new ImageLoader();
> outLoader.data = new ImageData[] { outImg };
> outLoader.save(outStream, SWT.IMAGE_JPEG);
> outStream.write(5);
> outStream.close();
>
> byte[] bytes = outStream.toByteArray();
>
> ByteArrayInputStream inStream = new ByteArrayInputStream(bytes);
> ImageLoader inLoader = new ImageLoader();
> inLoader.load(inStream);
> assertEquals(5, inStream.read());
> }
>
>
> I would expect to be able to read from the stream after loading the image,
> but this fails. Is this a bug?
>
>