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);
imageInByte = baos.toByteArray();