aspose file tools*
The moose likes Java Micro Edition and the fly likes Create image from byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Create image from byte array" Watch "Create image from byte array" New topic
Author

Create image from byte array

Ashley Burton
Greenhorn

Joined: Jul 15, 2009
Posts: 5
Hello,

I'm trying to send PNG image as a byte array from an application working on J2SE to the application on mobile phone(J2ME).
Simply, I'm encoding image(current source is file, but it may be catched camera frame) and i'm sending it to the mobile phone(via bluetooth).

In order to create an image in my j2me application i use a following code.



The problem is that when the image byte array is bigger(about 1000 bytes) i get IllegalArgumentException.

I spend few hours trying different types of encoding, but then i found out that small array bytes(about 200) worked fine.
There are no errors during array sending, so I'm a little bit confused.

Do you know some sure method to encode the image on j2se and recreate it on j2me?

Best

Ash




 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Create image from byte array