How can I send a picture in Java ME?

2019-07-21 03:24发布

How can I send a picture in Java ME ? Maybe using base64 decode and the send in post form via http request

标签: image java-me
5条回答
We Are One
2楼-- · 2019-07-21 03:32

I think you looking for this image base64 encoding in J2me

查看更多
Lonely孤独者°
3楼-- · 2019-07-21 03:48

There are plenty of coders in Base64 for Java. Apache commons has one, here is a standalone one.

查看更多
姐就是有狂的资本
4楼-- · 2019-07-21 03:52

Have you considered using a "multipart/form-data" encoding type? If you so, then there is no need for Base64 encoding. See here and here for instructions on how to build the request.

If you still want to do the Base64 encoding, then you will be able to easily find many source implementations on the Web. If you are developing both the server and client side, you could use your own implementation on both ends.

查看更多
forever°为你锁心
5楼-- · 2019-07-21 03:54

Yes , I'm use that to send the base64 ,putting in

// write your picture data to os

os.write (data);

where data = String with a base64 image , the problem is that i don't have a base64 library that works in java and asp in the same way.

查看更多
Evening l夕情丶
6楼-- · 2019-07-21 03:57
HttpConnection connection = (HttpConnection) Connector.open("http://www.myserver.com");
connection.setRequestMethod(HttpConnection.POST);
connection.setRequestProperty("Content-Type","image/png");
OutputStream os = connection.getOutputStream();
// write your picture data to os
os.flush();

if (connection.getResponseCode() == HttpConnection.HTTP_OK)
{
查看更多
登录 后发表回答