Results 1 to 1 of 1
- 10-28-2010, 09:03 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 1
- Rep Power
- 0
Cant pass ByteArray from Servlet to Midlet
Hi, I am very new to java. I am trying to capture the desktopscreen and pass that in the mobile. For that I had successfully captured the screen but having little problem in converting bufferedimage into bytes and sending that bytes to the midlet. I have used following codes, what shall i do to send byte array from servlet to midlet?
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
public class ScreenCapture {
BufferedImage bgetimage;
// private MediaTracker mediaTracker;
// private Image image;
public static byte[] imageInByte=null;
public static void main(String args[]) throws
AWTException, IOException {
// capture the whole screen
BufferedImage screencapture = new Robot().createScreenCapture(
new Rectangle(Toolkit.getDefaultToolkit().getScreenSiz e()));
// Save as JPEG
File file = new File("screencapture.jpg");
ImageIO.write(screencapture, "jpg", file);
//to convert bufferedimage into byte
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(screencapture, "jpg", baos);
baos.flush();
imageInByte = baos.toByteArray();
baos.close();
System.out.print(imageInByte);
}
}
Similar Threads
-
custom midlet-servlet chat app problem
By vukdavid in forum CLDC and MIDPReplies: 0Last Post: 09-22-2009, 12:30 PM -
How to pass value from servlet to midlet?
By sharmaj2me in forum CLDC and MIDPReplies: 1Last Post: 12-05-2008, 03:52 PM -
how to pass a List from a servlet to javascript..
By hussainzim in forum Java ServletReplies: 2Last Post: 09-09-2008, 12:17 PM -
Connectivity between Servlet and Midlet
By adarsh_2484 in forum New To JavaReplies: 1Last Post: 07-29-2008, 04:09 PM -
MIDLet calling Servlet
By ravian in forum Java ServletReplies: 1Last Post: 12-06-2007, 12:48 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks