Converts the byte array stored in the database to Image file (swt image) in Java


Creating an SWT Image from byte array in Java

Assuming “imageByte” as the byte array in the database

BufferedInputStream inputStreamReader = new BufferedInputStream(new ByteArrayInputStream(imageByte));
ImageData imageData = new ImageData(inputStreamReader);
Image byteImage = new Image(getDisplay(), imageData );

“byteImage” object is the SWT image generated from byte array

Advertisements

One Response to “Converts the byte array stored in the database to Image file (swt image) in Java”

  1. Debashish Says:

    Thanks for this code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s