开发者

Unable to stream image from midlet to browser?

My midlet acts as s开发者_Go百科erver , when i request any resource from midlet it must transferred to browser and displayed. Here i am able to transfer html files,but i am unable to transfer image through OutputStream. I am converting image to byte array also.


You're a bit light on detail here! I assume:

  • you have converted your J2ME Image to an int[] using Image.getRGB()
  • you are successfully sending the int array to wherever it needs to go, through your output stream (for example, by iterating through each int in the array, and sending it using DataOutput.writeInt())
  • you are successfully reconstructing this array at the server end
  • you are having difficulty converting the data back to an image at the server end

One way of doing this is to use BufferedImage on the server. You'll need to send the image's width and height to the server, along with the int array.

Then create a BufferedImage as follows:

BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
img.setRGB(0, 0, width, height, intArray, 0, width);

HTH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜