Java/J2ME/Image
Содержание
- 1 Download and view a png file
- 2 Draw immutable image on a canvas
- 3 Draw mutable image on a canvas
- 4 Image Loader
- 5 Image MIDlet
- 6 Immutable Image 1
- 7 Immutable Image Example
- 8 Immutable Image From Byte Array
- 9 ImmutableImage From File
- 10 MutableImage
- 11 Mutable Image Example
- 12 View Png 2
- 13 View Png Thread
Download and view a png file
/*--------------------------------------------------
* ViewPng.java
*
* Download and view a png file
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
public class ViewPng extends MIDlet implements CommandListener
{
private Display display;
private TextBox tbMain;
private Form fmViewPng;
private Command cmExit;
private Command cmView;
private Command cmBack;
public ViewPng()
{
display = Display.getDisplay(this);
// Create the Main textbox with a maximum of 75 characters
tbMain = new TextBox("Enter url", "http://www.corej2me.ru/midpbook_v1e1/ch14/duke.png", 75, 0);
// Create commands and add to textbox
cmExit = new Command("Exit", Command.EXIT, 1);
cmView = new Command("View", Command.SCREEN, 2);
tbMain.addCommand(cmExit);
tbMain.addCommand(cmView );
// Set up a listener for textbox
tbMain.setCommandListener(this);
// Create the form that will hold the png image
fmViewPng = new Form("");
// Create commands and add to form
cmBack = new Command("Back", Command.BACK, 1);
fmViewPng.addCommand(cmBack);
// Set up a listener for form
fmViewPng.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(tbMain);
}
public void pauseApp()
{ }
public void destroyApp(boolean unconditional)
{ }
/*--------------------------------------------------
* Process events
*-------------------------------------------------*/
public void commandAction(Command c, Displayable s)
{
// If the Command button pressed was "Exit"
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
else if (c == cmView)
{
// Download image and place on the form
try
{
Image im;
if ((im = getImage(tbMain.getString())) != null)
{
ImageItem ii = new ImageItem(null, im, ImageItem.LAYOUT_DEFAULT, null);
// If there is already an image, set (replace) it
if (fmViewPng.size() != 0)
fmViewPng.set(0, ii);
else // Append the image to the empty form
fmViewPng.append(ii);
}
else
fmViewPng.append("Unsuccessful download.");
// Display the form with the image
display.setCurrent(fmViewPng);
}
catch (Exception e)
{
System.err.println("Msg: " + e.toString());
}
}
else if (c == cmBack) {
display.setCurrent(tbMain);
}
}
/*--------------------------------------------------
* Open connection and download png into a byte array.
*-------------------------------------------------*/
private Image getImage(String url) throws IOException
{
ContentConnection connection = (ContentConnection) Connector.open(url);
// * There is a bug in MIDP 1.0.3 in which read() sometimes returns
// an invalid length. To work around this, I have changed the
// stream to DataInputStream and called readFully() instead of read()
// InputStream iStrm = connection.openInputStream();
DataInputStream iStrm = connection.openDataInputStream();
ByteArrayOutputStream bStrm = null;
Image im = null;
try
{
// ContentConnection includes a length method
byte imageData[];
int length = (int) connection.getLength();
if (length != -1)
{
imageData = new byte[length];
// Read the png into an array
// iStrm.read(imageData);
iStrm.readFully(imageData);
}
else // Length not available...
{
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
// Create the image from the byte array
im = Image.createImage(imageData, 0, imageData.length);
}
finally
{
// Clean up
if (iStrm != null)
iStrm.close();
if (connection != null)
connection.close();
if (bStrm != null)
bStrm.close();
}
return (im == null ? null : im);
}
}
Draw immutable image on a canvas
/*--------------------------------------------------
* ImmutableImage.java
*
* Draw immutable image on a canvas
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ImmutableImage extends MIDlet
{
private Display display; // The display
private ImageCanvas canvas; // Canvas
public ImmutableImage()
{
display = Display.getDisplay(this);
canvas = new ImageCanvas(this);
}
protected void startApp()
{
display.setCurrent( canvas );
}
protected void pauseApp()
{ }
protected void destroyApp( boolean unconditional )
{ }
public void exitMIDlet()
{
destroyApp(true);
notifyDestroyed();
}
}
/*--------------------------------------------------
* Class ImageCanvas
*
* Draw immutable image
*-------------------------------------------------*/
class ImageCanvas extends Canvas implements CommandListener
{
private Command cmExit; // Exit midlet
private ImmutableImage midlet;
private Image im = null;
public ImageCanvas(ImmutableImage midlet)
{
this.midlet = midlet;
// Create exit command & listen for events
cmExit = new Command("Exit", Command.EXIT, 1);
addCommand(cmExit);
setCommandListener(this);
try
{
// Create immutable image
im = Image.createImage("/image_bw.png");
}
catch (java.io.IOException e)
{
System.err.println("Unable to locate or read .png file");
}
}
/*--------------------------------------------------
* Draw immutable image
*-------------------------------------------------*/
protected void paint(Graphics g)
{
if (im != null)
g.drawImage(im, 10, 10, Graphics.LEFT | Graphics.TOP);
}
public void commandAction(Command c, Displayable d)
{
if (c == cmExit)
midlet.exitMIDlet();
}
}
Draw mutable image on a canvas
/*--------------------------------------------------
* MutableImage.java
*
* Draw mutable image on a canvas
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MutableImageWithCanvas extends MIDlet
{
private Display display; // The display
private ImageCanvas canvas; // Canvas
public MutableImageWithCanvas()
{
display = Display.getDisplay(this);
canvas = new ImageCanvas(this);
}
protected void startApp()
{
display.setCurrent( canvas );
}
protected void pauseApp()
{ }
protected void destroyApp( boolean unconditional )
{ }
public void exitMIDlet()
{
destroyApp(true);
notifyDestroyed();
}
}
/*--------------------------------------------------
* Class ImageCanvas
*
* Draw mutable image
*-------------------------------------------------*/
class ImageCanvas extends Canvas implements CommandListener
{
private Command cmExit; // Exit midlet
private MutableImage midlet;
private Image im = null;
private String message = "Core J2ME";
public ImageCanvas(MutableImage midlet)
{
this.midlet = midlet;
// Create exit command & listen for events
cmExit = new Command("Exit", Command.EXIT, 1);
addCommand(cmExit);
setCommandListener(this);
try
{
// Create mutable image
im = Image.createImage(80, 20);
// Get graphics object to draw onto the image
Graphics graphics = im.getGraphics();
// Specify a font face, style and size
Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
graphics.setFont(font);
// Draw a filled (black) rectangle
graphics.setColor(0, 0, 0);
graphics.fillRoundRect(0,0, im.getWidth()-1, im.getHeight()-1, 20, 20);
// Center text horizontally in the image. Draw text in white
graphics.setColor(255, 255, 255);
graphics.drawString(message,
(im.getWidth() / 2) - (font.stringWidth(message) / 2), 0,
Graphics.TOP | Graphics.LEFT);
}
catch (Exception e)
{
System.err.println("Error during image creation");
}
}
/*--------------------------------------------------
* Draw mutable image
*-------------------------------------------------*/
protected void paint(Graphics g)
{
// Center the image on the display
if (im != null)
g.drawImage(im, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
}
public void commandAction(Command c, Displayable d)
{
if (c == cmExit)
midlet.exitMIDlet();
}
}
Image Loader
/*
Wireless Java 2nd edition
Jonathan Knudsen
Publisher: Apress
ISBN: 1590590775
*/
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ImageLoader extends MIDlet
implements CommandListener, Runnable {
private Display mDisplay;
private Form mForm;
public ImageLoader() {
mForm = new Form("Connecting...");
mForm.addCommand(new Command("Exit", Command.EXIT, 0));
mForm.setCommandListener(this);
}
public void startApp() {
if (mDisplay == null) mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mForm);
// Do network loading in a separate thread.
Thread t = new Thread(this);
t.start();
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}
public void run() {
HttpConnection hc = null;
DataInputStream in = null;
try {
String url = getAppProperty("ImageLoader-URL");
hc = (HttpConnection)Connector.open(url);
int length = (int)hc.getLength();
byte[] data = null;
if (length != -1) {
data = new byte[length];
in = new DataInputStream(hc.openInputStream());
in.readFully(data);
}
else {
// If content length is not given, read in chunks.
int chunkSize = 512;
int index = 0;
int readLength = 0;
in = new DataInputStream(hc.openInputStream());
data = new byte[chunkSize];
do {
if (data.length < index + chunkSize) {
byte[] newData = new byte[index + chunkSize];
System.arraycopy(data, 0, newData, 0, data.length);
data = newData;
}
readLength = in.read(data, index, chunkSize);
index += readLength;
} while (readLength == chunkSize);
length = index;
}
Image image = Image.createImage(data, 0, length);
ImageItem imageItem = new ImageItem(null, image, 0, null);
mForm.append(imageItem);
mForm.setTitle("Done.");
}
catch (IOException ioe) {
StringItem stringItem = new StringItem(null, ioe.toString());
mForm.append(stringItem);
mForm.setTitle("Done.");
}
finally {
try {
if (in != null) in.close();
if (hc != null) hc.close();
}
catch (IOException ioe) {}
}
}
}
Image MIDlet
/*
J2ME in a Nutshell
By Kim Topley
ISBN: 0-596-00253-X
*/
import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.rumand;
import javax.microedition.lcdui.rumandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
public class ImageMIDlet extends MIDlet implements CommandListener {
// The MIDlet"s Display object
private Display display;
// Flag indicating first call of startApp
protected boolean started;
// Exit command
private Command exitCommand;
// Back to examples list command
private Command backCommand;
// The example selection list
private List examplesList;
// The Canvases used to demonstrate different Items
private Canvas[] canvases;
// The example names. Used to populate the list.
private String[] examples = {
"DrawImage", "ImageGraphics"
};
protected void startApp() {
if (!started) {
started = true;
display = Display.getDisplay(this);
// Create the common commands
createCommands();
// Create the canvases
createCanvases();
// Create the list of examples
createList();
// Start with the List
display.setCurrent(examplesList);
}
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (d == examplesList) {
// New example selected
int index = examplesList.getSelectedIndex();
display.setCurrent(canvases[index]);
} else if (c == exitCommand) {
// Exit. No need to call destroyApp
// because it is empty.
notifyDestroyed();
} else if (c == backCommand) {
// Go back to main selection list
display.setCurrent(examplesList);
}
}
private void createCommands() {
exitCommand = new Command("Exit", Command.EXIT, 0);
backCommand = new Command("Back", Command.BACK, 1);
}
private void createList() {
examplesList = new List("Select Example", List.IMPLICIT);
for (int i = 0; i < examples.length; i++) {
examplesList.append(examples[i], null);
}
examplesList.setCommandListener(this);
}
private void createCanvases() {
canvases = new Canvas[examples.length];
canvases[0] = createDrawImageCanvas();
canvases[1] = createImageGraphicsCanvas();
}
private void addCommands(Displayable d) {
d.addCommand(exitCommand);
d.addCommand(backCommand);
d.setCommandListener(this);
}
// Create the Canvas for the image drawing example
private Canvas createDrawImageCanvas() {
Canvas canvas = new DrawImageCanvas();
addCommands(canvas);
return canvas;
}
// Create the Canvas to demonstrate drawing to an Image
private Canvas createImageGraphicsCanvas() {
Canvas canvas = new ImageGraphicsCanvas();
addCommands(canvas);
return canvas;
}
}
// A canvas that illustrates image drawing
class DrawImageCanvas extends Canvas {
static Image image;
int count;
public void paint(Graphics g) {
int width = getWidth();
int height = getHeight();
// Fill the background using black
g.setColor(0);
g.fillRect(0, 0, width, height);
// Load an image from the MIDlet resources
if (image == null) {
try {
image = Image.createImage("/earth.png");
} catch (IOException ex) {
g.setColor(0xffffff);
g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);
return;
}
}
switch (count % 3) {
case 0:
// Draw the image at the top left of the screen
g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
break;
case 1:
// Draw it in the bottom right corner
g.drawImage(image, width, height, Graphics.BOTTOM | Graphics.RIGHT);
break;
case 2:
// Draw it in the center
g.drawImage(image, width/2, height/2, Graphics.VCENTER | Graphics.HCENTER);
}
count++;
}
}
// A canvas that illustrates drawing on an Image
class ImageGraphicsCanvas extends Canvas {
public void paint(Graphics g) {
int width = getWidth();
int height = getHeight();
// Create an Image the same size as the
// Canvas.
Image image = Image.createImage(width, height);
Graphics imageGraphics = image.getGraphics();
// Fill the background of the image black
imageGraphics.fillRect(0, 0, width, height);
// Draw a pattern of lines
int count = 10;
int yIncrement = height/count;
int xIncrement = width/count;
for (int i = 0, x = xIncrement, y = 0; i < count; i++) {
imageGraphics.setColor(0xC0 + ((128 + 10 * i) << 8) + ((128 + 10 * i) << 16));
imageGraphics.drawLine(0, y, x, height);
y += yIncrement;
x += xIncrement;
}
// Add some text
imageGraphics.setFont(Font.getFont(Font.FACE_PROPORTIONAL,
Font.STYLE_UNDERLINED, Font.SIZE_SMALL));
imageGraphics.setColor(0xffff00);
imageGraphics.drawString("Image Graphics", width/2, 0, Graphics.TOP | Graphics.HCENTER);
// Copy the Image to the screen
g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
}
}
Immutable Image 1
//jad file (please verify the jar size)
/*
MIDlet-Name: ImmutableImage
MIDlet-Version: 1.0
MIDlet-Vendor: MyCompany
MIDlet-Jar-URL: ImmutableImage.jar
MIDlet-1: ImmutableImage, , ImmutableImage
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
MIDlet-JAR-SIZE: 100
*/
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.rumand;
import javax.microedition.lcdui.rumandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.midlet.MIDlet;
public class ImmutableImage1 extends MIDlet implements CommandListener {
private Display display;
private Form form = new Form("Immutable Image Example");
private Command exit = new Command("Exit", Command.EXIT, 1);
private Image image;
private ImageItem imageItem;
public ImmutableImage1() {
display = Display.getDisplay(this);
form.addCommand(exit);
form.setCommandListener(this);
try {
image = Image.createImage("/myimage.png");
imageItem = new ImageItem(null, image, ImageItem.LAYOUT_NEWLINE_BEFORE
| ImageItem.LAYOUT_LEFT | ImageItem.LAYOUT_NEWLINE_AFTER, "My Image");
form.append(imageItem);
} catch (java.io.IOException error) {
Alert alert = new Alert("Error", "Cannot load myimage.png.", null, null);
alert.setTimeout(Alert.FOREVER);
alert.setType(AlertType.ERROR);
display.setCurrent(alert);
}
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable Displayable) {
if (command == exit) {
destroyApp(false);
notifyDestroyed();
}
}
}
Immutable Image Example
//jad file (please verify the jar size)
/*
MIDlet-Name: ImmutableImageExample
MIDlet-Version: 1.0
MIDlet-Vendor: MyCompany
MIDlet-Jar-URL: ImmutableImageExample.jar
MIDlet-1: ImmutableImageExample, , ImmutableImageExample
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
MIDlet-JAR-SIZE: 100
*/
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.rumand;
import javax.microedition.lcdui.rumandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
public class ImmutableImageExample extends MIDlet {
private Display display;
private MyCanvas canvas = new MyCanvas(this);
public ImmutableImageExample() {
display = Display.getDisplay(this);
}
protected void startApp() {
display.setCurrent(canvas);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
public void exitMIDlet() {
destroyApp(true);
notifyDestroyed();
}
public Display getDisplay() {
return display;
}
}
class MyCanvas extends Canvas implements CommandListener {
private Command exit;
private ImmutableImageExample immutableImageExample;
private Image image = null;
public MyCanvas(ImmutableImageExample immutableImageExample) {
this.immutableImageExample = immutableImageExample;
exit = new Command("Exit", Command.EXIT, 1);
addCommand(exit);
setCommandListener(this);
try {
image = Image.createImage("/myImage.png");
} catch (Exception error) {
Alert alert = new Alert("Failure", "Can"t open image file.", null, null);
alert.setTimeout(Alert.FOREVER);
immutableImageExample.getDisplay().setCurrent(alert);
}
}
protected void paint(Graphics graphics) {
if (image != null) {
graphics.drawImage(image, 0, 0, Graphics.VCENTER | Graphics.HCENTER);
}
}
public void commandAction(Command command, Displayable display) {
if (command == exit) {
immutableImageExample.exitMIDlet();
}
}
}
Immutable Image From Byte Array
/*--------------------------------------------------
* ImmutableImageFromByteArray.java
*
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ImmutableImageFromByteArray extends MIDlet implements CommandListener
{
private Display display;
private Form fmMain; // The main form
private Command cmExit; // Command to exit the MIDlet
public ImmutableImageFromByteArray()
{
display = Display.getDisplay(this);
cmExit = new Command("Exit", Command.EXIT, 1);
fmMain = new Form("");
fmMain.addCommand(cmExit);
fmMain.setCommandListener(this);
fmMain.append(new ImageItem(null, imColor, ImageItem.LAYOUT_NEWLINE_BEFORE | ImageItem.LAYOUT_CENTER, null));
// fmMain.append(imColor);
display.setCurrent(fmMain);
}
public void startApp()
{
display.setCurrent(fmMain);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s)
{
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
}
private static Image imColor = Image.createImage(
new byte[] {
(byte)0x89, (byte)0x50, (byte)0x4E, (byte)0x47, (byte)0x0D, (byte)0x0A, (byte)0x1A, (byte)0x0A,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0D, (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x4F, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x13,
(byte)0x08, (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0xA6, (byte)0x7F, (byte)0x60,
(byte)0x9C, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0xBA, (byte)0x49, (byte)0x44, (byte)0x41,
(byte)0x54, (byte)0x78, (byte)0x9C, (byte)0xAD, (byte)0x58, (byte)0x7F, (byte)0x6C, (byte)0x1B,
(byte)0xF5, (byte)0x15, (byte)0xFF, (byte)0x5C, (byte)0x92, (byte)0x2A, (byte)0x4B, (byte)0xCB,
(byte)0x85, (byte)0xF3, (byte)0xB2, (byte)0xAE, (byte)0x5B, (byte)0xC0, (byte)0x8E, (byte)0xA3,
(byte)0x22, (byte)0xA6, (byte)0x81, (byte)0x9C, (byte)0xD9, (byte)0xED, (byte)0x54, (byte)0x09,
(byte)0xA9, (byte)0xB6, (byte)0x9C, (byte)0xBF, (byte)0x10, (byte)0xA0, (byte)0x46, (byte)0xED,
(byte)0x44, (byte)0x2B, (byte)0x04, (byte)0xE8, (byte)0x92, (byte)0xB3, (byte)0xA2, (byte)0x0D,
(byte)0x5A, (byte)0xC9, (byte)0x91, (byte)0xA3, (byte)0xC1, (byte)0x1F, (byte)0x0B, (byte)0x4B,
(byte)0x95, (byte)0x08, (byte)0x21, (byte)0xC4, (byte)0xC0, (byte)0xC5, (byte)0x91, (byte)0x80,
(byte)0x22, (byte)0x2A, (byte)0xBB, (byte)0xB6, (byte)0x36, (byte)0x44, (byte)0x8B, (byte)0xB4,
(byte)0x80, (byte)0x29, (byte)0xBF, (byte)0x24, (byte)0x84, (byte)0xA3, (byte)0xB3, (byte)0xC4,
(byte)0xA6, (byte)0xAD, (byte)0x99, (byte)0x5D, (byte)0x5B, (byte)0x83, (byte)0x05, (byte)0x8D,
(byte)0xD9, (byte)0xB5, (byte)0x19, (byte)0x5D, (byte)0x21, (byte)0xD4, (byte)0xC7, (byte)0x1D,
(byte)0x76, (byte)0x1B, (byte)0x35, (byte)0xD9, (byte)0xE3, (byte)0x8F, (byte)0xF4, (byte)0x8E,
(byte)0x3B, (byte)0xDF, (byte)0xF9, (byte)0x47, (byte)0xDA, (byte)0x7C, (byte)0xA4, (byte)0xAF,
(byte)0xEE, (byte)0xEE, (byte)0x7D, (byte)0xDF, (byte)0xF7, (byte)0x7D, (byte)0xDF, (byte)0xF7,
(byte)0x7D, (byte)0xDF, (byte)0x7B, (byte)0xDF, (byte)0x77, (byte)0x5F, (byte)0x10, (byte)0x11,
(byte)0x2C, (byte)0xDB, (byte)0x93, (byte)0xAE, (byte)0x9C, (byte)0xFE, (byte)0xBB, (byte)0xC3,
(byte)0x09, (byte)0x81, (byte)0x9C, (byte)0x10, (byte)0x08, (byte)0x7A, (byte)0x84, (byte)0x7D,
(byte)0x22, (byte)0xBE, (byte)0xC8, (byte)0xBB, (byte)0x00, (byte)0xC0, (byte)0xE1, (byte)0xC8,
(byte)0x95, (byte)0x18, (byte)0x66, (byte)0xB1, (byte)0x81, (byte)0x34, (byte)0x22, (byte)0xD0,
(byte)0x61, (byte)0x90, (byte)0xFE, (byte)0xDB, (byte)0x9A, (byte)0xE9, (byte)0xC5, (byte)0x7D,
(byte)0xC9, (byte)0x7A, (byte)0x1A, (byte)0x06, (byte)0x68, (byte)0x8C, (byte)0x88, (byte)0x08,
(byte)0x45, (byte)0x76, (byte)0xAF, (byte)0x5C, (byte)0xC0, (byte)0xAE, (byte)0x75, (byte)0x29,
(byte)0x21, (byte)0x56, (byte)0xA6, (byte)0xE7, (byte)0xBC, (byte)0x22, (byte)0x11, (byte)0x01,
(byte)0x38, (byte)0x4B, (byte)0xC0, (byte)0x59, (byte)0xD2, (byte)0x18, (byte)0x97, (byte)0x83,
(byte)0xCF, (byte)0x44, (byte)0x0C, (byte)0xD3, (byte)0x96, (byte)0x32, (byte)0x6E, (byte)0x83,
(byte)0x44, (byte)0x89, (byte)0xAA, (byte)0xDC, (byte)0x00, (byte)0x8D, (byte)0x91, (byte)0x44,
(byte)0x55, (byte)0xAE, (byte)0x7E, (byte)0x3A, (byte)0x6D, (byte)0x06, (byte)0x75, (byte)0xB0,
(byte)0xBE, (byte)0xE9, (byte)0xF8, (byte)0x32, (byte)0x99, (byte)0xAA, (byte)0x9B, (byte)0x65,
(byte)0xFF, (byte)0x21, (byte)0x13, (byte)0x11, (byte)0x3A, (byte)0xC6, (byte)0x11, (byte)0x49,
(byte)0x02, (byte)0x80, (byte)0xFA, (byte)0x04, (byte)0x80, (byte)0x22, (byte)0xB3, (byte)0x9B,
(byte)0x8A, (byte)0xCC, (byte)0x6E, (byte)0x72, (byte)0xD2, (byte)0x22, (byte)0x63, (byte)0xB0,
(byte)0xDA, (byte)0x1E, (byte)0x3E, (byte)0x81, (byte)0x87, (byte)0xA3, (byte)0x01, (byte)0xD4,
(byte)0xC1, (byte)0xE3, (byte)0xF9, (byte)0x24, (byte)0xA3, (byte)0x28, (byte)0xFF, (byte)0x67,
(byte)0x01, (byte)0x34, (byte)0x30, (byte)0xCE, (byte)0xB5, (byte)0x26, (byte)0x47, (byte)0xDF,
(byte)0x14, (byte)0x0C, (byte)0xB4, (byte)0xA5, (byte)0x94, (byte)0x9F, (byte)0xAA, (byte)0x15,
(byte)0xD3, (byte)0x4A, (byte)0x4C, (byte)0x46, (byte)0x54, (byte)0xED, (byte)0xD3, (byte)0x72,
(byte)0xC9, (byte)0x4B, (byte)0x29, (byte)0x7F, (byte)0xFD, (byte)0x72, (byte)0x55, (byte)0x43,
(byte)0x6B, (byte)0x0E, (byte)0x51, (byte)0xAF, (byte)0xBE, (byte)0x7E, (byte)0xD9, (byte)0x3F,
(byte)0xCD, (byte)0xBC, (byte)0xEA, (byte)0x01, (byte)0x00, (byte)0xBC, (byte)0x3E, (byte)0x11,
(byte)0xC1, (byte)0x4E, (byte)0x6F, (byte)0x1A, (byte)0x91, (byte)0xE1, (byte)0x14, (byte)0xF6,
(byte)0xF0, (byte)0x09, (byte)0x84, (byte)0x7D, (byte)0xA2, (byte)0xCA, (byte)0xC7, (byte)0x30,
(byte)0x8B, (byte)0xA4, (byte)0x3E, (byte)0xB3, (byte)0xD9, (byte)0x9A, (byte)0xDB, (byte)0xA4,
(byte)0x61, (byte)0xC9, (byte)0x7E, (byte)0x4F, (byte)0xE9, (byte)0x4A, (byte)0xE6, (byte)0x5F,
(byte)0xEE, (byte)0xCF, (byte)0x5D, (byte)0x87, (byte)0xBE, (byte)0x77, (byte)0xC5, (byte)0x52,
(byte)0xC6, (byte)0x6D, (byte)0xD0, (byte)0xF0, (byte)0x74, (byte)0x50, (byte)0xDB, (byte)0x69,
(byte)0x9E, (byte)0xFF, (byte)0x4F, (byte)0x5C, (byte)0x75, (byte)0x05, (byte)0x22, (byte)0x02,
(byte)0x4E, (byte)0x91, (byte)0x28, (byte)0x9C, (byte)0x22, (byte)0x51, (byte)0x68, (byte)0xB8,
(byte)0xD4, (byte)0x36, (byte)0x96, (byte)0x6C, (byte)0xF2, (byte)0xD8, (byte)0x53, (byte)0x24,
(byte)0x0A, (byte)0x03, (byte)0x34, (byte)0x46, (byte)0xF5, (byte)0x82, (byte)0x9B, (byte)0xB5,
(byte)0x6F, (byte)0xE7, (byte)0x3F, (byte)0xDC, (byte)0x5F, (byte)0x64, (byte)0xF7, (byte)0xCA,
(byte)0xA6, (byte)0x3E, (byte)0x75, (byte)0x35, (byte)0x7A, (byte)0x05, (byte)0x0E, (byte)0x83,
(byte)0xE8, (byte)0xA3, (byte)0x68, (byte)0xDB, (byte)0xB2, (byte)0x0D, (byte)0x0A, (byte)0xDE,
(byte)0x4F, (byte)0x4F, (byte)0x89, (byte)0xAA, (byte)0x19, (byte)0x07, (byte)0x68, (byte)0x8C,
(byte)0xEE, (byte)0xA7, (byte)0xA7, (byte)0xC4, (byte)0x56, (byte)0x83, (byte)0x2E, (byte)0x4D,
(byte)0xBF, (byte)0x34, (byte)0x53, (byte)0xC0, (byte)0x2E, (byte)0x32, (byte)0x59, (byte)0x26,
(byte)0x3B, (byte)0xBF, (byte)0x5F, (byte)0x53, (byte)0xA8, (byte)0x94, (byte)0x71, (byte)0xD3,
(byte)0x49, (byte)0x3E, (byte)0x4E, (byte)0xCB, (byte)0xC5, (byte)0x01, (byte)0x8D, (byte)0x66,
(byte)0x11, (byte)0xAA, (byte)0x44, (byte)0x84, (byte)0x60, (byte)0xB0, (byte)0x14, (byte)0xD1,
(byte)0x22, (byte)0x52, (byte)0xB7, (byte)0x1D, (byte)0x44, (byte)0x04, (byte)0x66, (byte)0x80,
(byte)0xC6, (byte)0xC8, (byte)0xE4, (byte)0x30, (byte)0x88, (byte)0x19, (byte)0xE2, (byte)0xE3,
(byte)0x7C, (byte)0xAF, (byte)0x57, (byte)0x26, (byte)0xA5, (byte)0xC6, (byte)0x3A, (byte)0x69,
(byte)0x91, (byte)0xB9, (byte)0xE0, (byte)0x1B, (byte)0x17, (byte)0x57, (byte)0xD2, (byte)0x19,
(byte)0x2F, (byte)0x1B, (byte)0x7C, (byte)0x60, (byte)0xAE, (byte)0x2F, (byte)0xF2, (byte)0xD8,
(byte)0x84, (byte)0x61, (byte)0x60, (byte)0x7C, (byte)0x34, (byte)0x8E, (byte)0xBF, (byte)0x25,
(byte)0x78, (byte)0x00, (byte)0x40, (byte)0xBF, (byte)0x2B, (byte)0xAF, (byte)0x66, (byte)0x22,
(byte)0x74, (byte)0xB3, (byte)0x0A, (byte)0x56, (byte)0x94, (byte)0xF5, (byte)0x38, (byte)0x7A,
(byte)0x81, (byte)0x0C, (byte)0xB2, (byte)0x1D, (byte)0x8E, (byte)0x5C, (byte)0xA9, (byte)0x5C,
(byte)0xBE, (byte)0x6A, (byte)0xB7, (byte)0x72, (byte)0xDC, (byte)0x4C, (byte)0xE6, (byte)0xE7,
(byte)0x1E, (byte)0x46, (byte)0xA2, (byte)0x2A, (byte)0xF7, (byte)0x0B, (byte)0x1C, (byte)0xA9,
(byte)0xA8, (byte)0xC4, (byte)0x73, (byte)0x78, (byte)0xC1, (byte)0x76, (byte)0x33, (byte)0xB6,
(byte)0x4A, (byte)0x56, (byte)0x5E, (byte)0xAE, (byte)0xBE, (byte)0x9B, (byte)0x02, (byte)0x5C,
(byte)0x8F, (byte)0x23, (byte)0xCC, (byte)0xF7, (byte)0x0B, (byte)0x9E, (byte)0x48, (byte)0x0D,
(byte)0x23, (byte)0x32, (byte)0x9C, (byte)0xD2, (byte)0xBE, (byte)0xEB, (byte)0x94, (byte)0xD3,
(byte)0x23, (byte)0x9B, (byte)0xAD, (byte)0xB9, (byte)0x3D, (byte)0x9E, (byte)0x4F, (byte)0x32,
(byte)0x2C, (byte)0xDB, (byte)0xA1, (byte)0xC8, (byte)0xB2, (byte)0xA7, (byte)0x57, (byte)0xEB,
(byte)0xD8, (byte)0x88, (byte)0x3F, (byte)0xAC, (byte)0x56, (byte)0xE4, (byte)0xA6, (byte)0x49,
(byte)0xC1, (byte)0xD0, (byte)0x3E, (byte)0x8A, (byte)0x0A, (byte)0xB4, (byte)0x5C, (byte)0x70,
(byte)0xD2, (byte)0x07, (byte)0xE1, (byte)0xD0, (byte)0xF5, (byte)0xF8, (byte)0x9E, (byte)0x21,
(byte)0x48, (byte)0xAE, (byte)0xA7, (byte)0xD5, (byte)0x52, (byte)0x7F, (byte)0xF7, (byte)0x37,
(byte)0x55, (byte)0x2E, (byte)0xC4, (byte)0xCA, (byte)0x74, (byte)0x18, (byte)0x74, (byte)0x23,
(byte)0x0A, (byte)0x32, (byte)0x44, (byte)0x84, (byte)0x3B, (byte)0xF1, (byte)0xA8, (byte)0x0C,
(byte)0x00, (byte)0xFF, (byte)0xC4, (byte)0x4B, (byte)0xBD, (byte)0x8D, (byte)0xCC, (byte)0x6F,
(byte)0xB5, (byte)0xDD, (byte)0x96, (byte)0xDB, (byte)0x3C, (byte)0xD9, (byte)0x2B, (byte)0x6B,
(byte)0xBE, (byte)0xA6, (byte)0x47, (byte)0x93, (byte)0xAD, (byte)0x6D, (byte)0x84, (byte)0x8E,
(byte)0x3B, (byte)0xF1, (byte)0xA8, (byte)0x5C, (byte)0xC5, (byte)0x15, (byte)0xB6, (byte)0x8A,
(byte)0x2B, (byte)0xAC, (byte)0xAA, (byte)0x64, (byte)0x2B, (byte)0x7C, (byte)0x73, (byte)0xEC,
(byte)0x4F, (byte)0x21, (byte)0xFD, (byte)0x53, (byte)0xC3, (byte)0x99, (byte)0xA3, (byte)0x33,
(byte)0x96, (byte)0x8A, (byte)0x01, (byte)0xC0, (byte)0x94, (byte)0xA3, (byte)0xD4, (byte)0x4C,
(byte)0x66, (byte)0x6F, (byte)0x6F, (byte)0x46, (byte)0xD6, (byte)0xB2, (byte)0xF2, (byte)0x35,
(byte)0x98, (byte)0x22, (byte)0xB7, (byte)0x3E, (byte)0x6A, (byte)0xAD, (byte)0xA0, (byte)0x06,
(byte)0xC9, (byte)0x16, (byte)0xD7, (byte)0x6D, (byte)0xF9, (byte)0x5B, (byte)0x72, (byte)0xA7,
(byte)0x86, (byte)0xB4, (byte)0x0E, (byte)0x7D, (byte)0x50, (byte)0x3C, (byte)0x1C, (byte)0x0D,
(byte)0xA0, (byte)0x26, (byte)0x71, (byte)0xF8, (byte)0x6B, (byte)0x4C, (byte)0xD0, (byte)0x22,
(byte)0xB8, (byte)0x81, (byte)0xF5, (byte)0xD4, (byte)0x23, (byte)0x43, (byte)0x45, (byte)0x30,
(byte)0xF8, (byte)0xE3, (byte)0xB9, (byte)0x48, (byte)0xC4, (byte)0x3E, (byte)0xD1, (byte)0xD5,
(byte)0x4A, (byte)0x11, (byte)0x00, (byte)0x58, (byte)0xC9, (byte)0x2E, (byte)0xB9, (byte)0xBB,
(byte)0x9C, (byte)0xFD, (byte)0xC5, (byte)0x4E, (byte)0x8E, (byte)0x95, (byte)0xBE, (byte)0x1A,
(byte)0x9D, (byte)0x8E, (byte)0x03, (byte)0x00, (byte)0xC3, (byte)0x6E, (byte)0x55, (byte)0x0C,
(byte)0x8A, (byte)0x01, (byte)0xC0, (byte)0x4E, (byte)0x6F, (byte)0x1A, (byte)0x00, (byte)0x70,
(byte)0x70, (byte)0x2E, (byte)0x88, (byte)0xA7, (byte)0x3D, (byte)0x19, (byte)0x00, (byte)0xEB,
(byte)0x91, (byte)0x7B, (byte)0x66, (byte)0x7A, (byte)0xD6, (byte)0x4A, (byte)0xAE, (byte)0x1A,
(byte)0xA9, (byte)0xF5, (byte)0xF4, (byte)0xB9, (byte)0xB9, (byte)0x2F, (byte)0x83, (byte)0xF3,
(byte)0xF3, (byte)0x95, (byte)0x03, (byte)0x2D, (byte)0x95, (byte)0x5B, (byte)0xC9, (byte)0x2E,
(byte)0xB9, (byte)0x2F, (byte)0x78, (byte)0x1E, (byte)0xCC, (byte)0x6C, (byte)0xE3, (byte)0xEF,
(byte)0x4B, (byte)0x6C, (byte)0x8F, (byte)0xCF, (byte)0x8E, (byte)0x56, (byte)0x13, (byte)0x6F,
(byte)0xF3, (byte)0x00, (byte)0x30, (byte)0x20, (byte)0xA7, (byte)0xCD, (byte)0xFE, (byte)0xF9,
(byte)0x59, (byte)0xDA, (byte)0x0B, (byte)0x00, (byte)0xB8, (byte)0x54, (byte)0x74, (byte)0x6A,
(byte)0xB4, (byte)0x3E, (byte)0x67, (byte)0x51, (byte)0xA3, (byte)0x6F, (byte)0x10, (byte)0x2D,
(byte)0xB7, (byte)0x75, (byte)0x4D, (byte)0x52, (byte)0xB8, (byte)0xB2, (byte)0xCD, (byte)0x5F,
(byte)0x01, (byte)0x80, (byte)0x4E, (byte)0xFB, (byte)0x8E, (byte)0xF2, (byte)0x5A, (byte)0xF9,
(byte)0xA2, (byte)0xDD, (byte)0x5E, (byte)0x59, (byte)0xB0, (byte)0x75, (byte)0x72, (byte)0xAC,
(byte)0x29, (byte)0x27, (byte)0x1A, (byte)0xB6, (byte)0x75, (byte)0xB6, (byte)0xE8, (byte)0x04,
(byte)0x88, (byte)0xC1, (byte)0xF4, (byte)0x60, (byte)0x41, (byte)0xA3, (byte)0xB5, (byte)0xB9,
(byte)0xAD, (byte)0x3C, (byte)0xFF, (byte)0xC3, (byte)0x44, (byte)0x3C, (byte)0x3E, (byte)0x38,
(byte)0xDA, (byte)0xB1, (byte)0x0D, (byte)0x3F, (byte)0x50, (byte)0x54, (byte)0xA2, (byte)0xFE,
(byte)0x5D, (byte)0x45, (byte)0x27, (byte)0xC7, (byte)0x4A, (byte)0xDD, (byte)0x5E, (byte)0x4F,
(byte)0x1A, (byte)0x00, (byte)0xD6, (byte)0xCA, (byte)0x17, (byte)0xED, (byte)0x3B, (byte)0x52,
(byte)0x2F, (byte)0x0F, (byte)0x5B, (byte)0x2A, (byte)0x06, (byte)0x00, (byte)0xBF, (byte)0x9E,
(byte)0x3F, (byte)0xA0, (byte)0xBD, (byte)0x4F, (byte)0x3B, (byte)0x8B, (byte)0x06, (byte)0xC5,
(byte)0xF6, (byte)0xF0, (byte)0x09, (byte)0xCB, (byte)0x31, (byte)0x00, (byte)0x88, (byte)0x76,
(byte)0x33, (byte)0x2C, (byte)0xDB, (byte)0xA1, (byte)0x00, (byte)0xEB, (byte)0x27, (byte)0x44,
(byte)0x3C, (byte)0x3E, (byte)0x38, (byte)0x7A, (byte)0xAD, (byte)0x83, (byte)0x70, (byte)0x07,
(byte)0x3D, (byte)0x22, (byte)0xDF, (byte)0x41, (byte)0x8F, (byte)0x98, (byte)0x0F, (byte)0x76,
(byte)0x5D, (byte)0x2B, (byte)0x60, (byte)0x17, (byte)0x7D, (byte)0xC9, (byte)0xFF, (byte)0x3E,
(byte)0xDE, (byte)0x32, (byte)0x3F, (byte)0x9D, (byte)0xE4, (byte)0xE3, (byte)0xA6, (byte)0x7A,
(byte)0xF3, (byte)0x77, (byte)0xF6, (byte)0xD2, (byte)0x75, (byte)0xE7, (byte)0xB9, (byte)0x76,
(byte)0x70, (byte)0x79, (byte)0xE1, (byte)0xAC, (byte)0xBF, (byte)0xC7, (byte)0xFF, (byte)0xCB,
(byte)0x85, (byte)0xB6, (byte)0x98, (byte)0x6B, (byte)0x12, (byte)0x87, (byte)0x0F, (byte)0x8F,
(byte)0xAD, (byte)0xA7, (byte)0x99, (byte)0xBB, (byte)0x84, (byte)0x18, (byte)0xFA, (byte)0x9C,
(byte)0xC5, (byte)0xB6, (byte)0xC6, (byte)0xD5, (byte)0xA1, (byte)0x6D, (byte)0xE5, (byte)0x36,
(byte)0x13, (byte)0x17, (byte)0x7C, (byte)0xE3, (byte)0x62, (byte)0xD7, (byte)0x60, (byte)0x7F,
(byte)0x61, (byte)0x7B, (byte)0x7C, (byte)0x76, (byte)0xB4, (byte)0xAD, (byte)0x01, (byte)0x5F,
(byte)0x17, (byte)0x9D, (byte)0x38, (byte)0x3E, (byte)0x92, (byte)0xD4, (byte)0x52, (byte)0x12,
(byte)0x60, (byte)0x3E, (byte)0xBF, (byte)0xBB, (byte)0x59, (byte)0x05, (byte)0x07, (byte)0x23,
(byte)0x13, (byte)0xB8, (byte)0x4B, (byte)0x88, (byte)0x6D, (byte)0xBA, (byte)0xC2, (byte)0x0D,
(byte)0xD0, (byte)0x01, (byte)0x00, (byte)0xA7, (byte)0x91, (byte)0x16, (byte)0xD4, (byte)0xFF,
(byte)0x31, (byte)0x7D, (byte)0x3B, (byte)0x8D, (byte)0xB4, (byte)0xB0, (byte)0xD9, (byte)0x13,
(byte)0x96, (byte)0x1D, (byte)0xF7, (byte)0x96, (byte)0x56, (byte)0xD2, (byte)0x19, (byte)0x6F,
(byte)0x35, (byte)0xF1, (byte)0x36, (byte)0xBF, (byte)0x92, (byte)0x5D, (byte)0x72, (byte)0x37,
(byte)0x65, (byte)0xAE, (byte)0x49, (byte)0x1C, (byte)0xA6, (byte)0x1C, (byte)0x25, (byte)0x4C,
(byte)0x0F, (byte)0x16, (byte)0x0C, (byte)0x86, (byte)0xB3, (byte)0xC2, (byte)0x8A, (byte)0xC2,
(byte)0xE2, (byte)0x8F, (byte)0x81, (byte)0x28, (byte)0x8E, (byte)0x30, (byte)0x84, (byte)0x4F,
(byte)0x17, (byte)0xFC, (byte)0x37, (byte)0xA2, (byte)0xA3, (byte)0x24, (byte)0xAD, (byte)0x72,
(byte)0x43, (byte)0x43, (byte)0x1F, (byte)0xE7, (byte)0x86, (byte)0x86, (byte)0x3E, (byte)0xCE,
(byte)0x49, (byte)0xD2, (byte)0x2A, (byte)0xD7, (byte)0x88, (byte)0xAF, (byte)0xE3, (byte)0x04,
(byte)0xDE, (byte)0x0F, (byte)0x3D, (byte)0x8E, (byte)0x68, (byte)0xD4, (byte)0xAA, (byte)0xF3,
(byte)0x71, (byte)0x44, (byte)0xA3, (byte)0x27, (byte)0xF0, (byte)0x7E, (byte)0xC8, (byte)0xAA,
(byte)0x6F, (byte)0xA3, (byte)0x58, (byte)0x93, (byte)0x14, (byte)0xEE, (byte)0x7C, (byte)0xAF,
(byte)0x57, (byte)0x5E, (byte)0x2B, (byte)0x5F, (byte)0xD4, (byte)0x4A, (byte)0xCD, (byte)0x4B,
(byte)0xC1, (byte)0x3F, (byte)0xCC, (byte)0x35, (byte)0x1C, (byte)0x50, (byte)0x93, (byte)0x38,
(byte)0x3C, (byte)0xE1, (byte)0x28, (byte)0x41, (byte)0x2A, (byte)0x9B, (byte)0x4B, (byte)0xD3,
(byte)0x3D, (byte)0x7C, (byte)0x02, (byte)0x7D, (byte)0xCE, (byte)0x22, (byte)0x7E, (byte)0x15,
(byte)0x9E, (byte)0x04, (byte)0x67, (byte)0x2F, (byte)0x9B, (byte)0xFA, (byte)0x23, (byte)0xC3,
(byte)0x29, (byte)0xFC, (byte)0x25, (byte)0xB6, (byte)0xE1, (byte)0x8D, (byte)0x8F, (byte)0xC5,
(byte)0x96, (byte)0x05, (byte)0x86, (byte)0x59, (byte)0x24, (byte)0x9B, (byte)0xED, (byte)0x5C,
(byte)0x25, (byte)0x9F, (byte)0xBF, (byte)0xEC, (byte)0xCA, (byte)0xE7, (byte)0x2F, (byte)0xBB,
(byte)0x6C, (byte)0xB6, (byte)0x73, (byte)0x15, (byte)0x86, (byte)0x59, (byte)0xA4, (byte)0x58,
(byte)0x6C, (byte)0xD9, (byte)0x24, (byte)0xCF, (byte)0xB2, (byte)0x76, (byte)0xAF, (byte)0x47,
(byte)0x3B, (byte)0x55, (byte)0x81, (byte)0x8A, (byte)0x35, (byte)0x49, (byte)0xE1, (byte)0xEA,
(byte)0xB3, (byte)0xF5, (byte)0xD5, (byte)0xE2, (byte)0x17, (byte)0xCE, (byte)0xFF, (byte)0x0E,
(byte)0xEE, (byte)0x2B, (byte)0xE8, (byte)0x69, (byte)0x0C, (byte)0xBB, (byte)0x55, (byte)0xB9,
(byte)0xB5, (byte)0xF4, (byte)0x8E, (byte)0xA3, (byte)0x61, (byte)0x66, (byte)0x3F, (byte)0x73,
(byte)0x74, (byte)0x06, (byte)0xEF, (byte)0xCE, (byte)0x4E, (byte)0x1B, (byte)0x68, (byte)0xFE,
(byte)0xE0, (byte)0x1C, (byte)0x7A, (byte)0x38, (byte)0xC9, (byte)0x40, (byte)0xEF, (byte)0x77,
(byte)0xE5, (byte)0xC1, (byte)0x27, (byte)0x78, (byte)0xED, (byte)0x50, (byte)0x57, (byte)0xD1,
(byte)0xCD, (byte)0x2A, (byte)0x08, (byte)0xCB, (byte)0x2D, (byte)0x6B, (byte)0x41, (byte)0x49,
(byte)0x5A, (byte)0xE5, (byte)0x46, (byte)0x46, (byte)0x3E, (byte)0x4B, (byte)0xA6, (byte)0xD3,
(byte)0xDF, (byte)0xB6, (byte)0x75, (byte)0xD6, (byte)0x7A, (byte)0xBD, (byte)0x37, (byte)0xA5,
(byte)0x93, (byte)0xC9, (byte)0x9D, (byte)0x23, (byte)0x1C, (byte)0xD7, (byte)0x25, (byte)0x6D,
(byte)0x9A, (byte)0xF1, (byte)0x56, (byte)0xB2, (byte)0x4B, (byte)0xEE, (byte)0xFF, (byte)0xF9,
(byte)0xC6, (byte)0x45, (byte)0x52, (byte)0x6A, (byte)0xEC, (byte)0xF6, (byte)0xF9, (byte)0x67,
(byte)0x0F, (byte)0x6C, (byte)0xDB, (byte)0x3F, (byte)0xFC, (byte)0x06, (byte)0xB0, (byte)0x9E,
(byte)0xC8, (byte)0x2F, (byte)0x0E, (byte)0xFF, (byte)0x26, (byte)0xA5, (byte)0xE7, (byte)0xED,
(byte)0x8B, (byte)0x1E, (byte)0x0D, (byte)0xB0, (byte)0xC2, (byte)0x48, (byte)0xF3, (byte)0xDC,
(byte)0x54, (byte)0xCE, (byte)0xBA, (byte)0x71, (byte)0x59, (byte)0x32, (byte)0x86, (byte)0xCC,
(byte)0xAD, (byte)0xEE, (byte)0x2C, (byte)0x1E, (byte)0xB3, (byte)0x55, (byte)0x4C, (byte)0xBC,
(byte)0x13, (byte)0xA9, (byte)0x61, (byte)0xF4, (byte)0x70, (byte)0x92, (byte)0x89, (byte)0xFF,
(byte)0x76, (byte)0xFF, (byte)0x42, (byte)0xB3, (byte)0x29, (byte)0x9A, (byte)0xFD, (byte)0x74,
(byte)0xB5, (byte)0x82, (byte)0xDD, (byte)0xBE, (byte)0xA5, (byte)0xBC, (byte)0x29, (byte)0xC6,
(byte)0xAB, (byte)0x1C, (byte)0x3D, (byte)0x3E, (byte)0xF3, (byte)0xCD, (byte)0xEC, (byte)0x2B,
(byte)0x9A, (byte)0x37, (byte)0x74, (byte)0xDA, (byte)0x77, (byte)0x94, (byte)0xED, (byte)0xA5,
(byte)0x77, (byte)0x1C, (byte)0xD5, (byte)0x37, (byte)0x52, (byte)0xFB, (byte)0xBF, (byte)0x3A,
(byte)0xF0, (byte)0xDB, (byte)0x79, (byte)0x95, (byte)0xDE, (byte)0xB3, (byte)0xCF, (byte)0xFB,
(byte)0xD6, (byte)0x8E, (byte)0xE4, (byte)0xF3, (byte)0x23, (byte)0x6D, (byte)0x69, (byte)0x67,
(byte)0xE5, (byte)0x79, (byte)0x3B, (byte)0xBD, (byte)0x69, (byte)0x1C, (byte)0x9C, (byte)0x0B,
(byte)0xE2, (byte)0x98, (byte)0x4F, (byte)0xD4, (byte)0x0A, (byte)0xF0, (byte)0x7B, (byte)0xA6,
(byte)0x67, (byte)0xD1, (byte)0xC3, (byte)0x49, (byte)0xF8, (byte)0xF3, (byte)0x64, (byte)0xD8,
(byte)0xC0, (byte)0xDB, (byte)0xEF, (byte)0xCA, (byte)0x63, (byte)0x2A, (byte)0x67, (byte)0x2C,
(byte)0x3F, (byte)0x2D, (byte)0x70, (byte)0x43, (byte)0x9E, (byte)0xF7, (byte)0x0A, (byte)0xBD,
(byte)0x17, (byte)0x7A, (byte)0x12, (byte)0xAF, (byte)0x85, (byte)0x1B, (byte)0x31, (byte)0x3F,
(byte)0x81, (byte)0x07, (byte)0x26, (byte)0xC7, (byte)0x71, (byte)0xF7, (byte)0xB1, (byte)0x56,
(byte)0x42, (byte)0x95, (byte)0x58, (byte)0x52, (byte)0xF8, (byte)0x3A, (byte)0x30, (byte)0xA3,
(byte)0xE5, (byte)0xCE, (byte)0x2D, (byte)0xAE, (byte)0xDB, (byte)0xF2, (byte)0x57, (byte)0xF3,
(byte)0xFF, (byte)0x76, (byte)0x01, (byte)0xEB, (byte)0x21, (byte)0xFA, (byte)0x13, (byte)0xF1,
(byte)0x84, (byte)0xAF, (byte)0xDB, (byte)0xFD, (byte)0xB3, (byte)0x6C, (byte)0x3B, (byte)0x0A,
(byte)0x6A, (byte)0x98, (byte)0x6A, (byte)0x90, (byte)0xF3, (byte)0xBA, (byte)0x59, (byte)0x05,
(byte)0x21, (byte)0xD1, (byte)0x87, (byte)0xE3, (byte)0x23, (byte)0x49, (byte)0xCB, (byte)0x7E,
(byte)0x00, (byte)0x98, (byte)0x2D, (byte)0x0C, (byte)0x6E, (byte)0xB4, (byte)0x04, (byte)0x89,
(byte)0xC5, (byte)0x96, (byte)0x85, (byte)0x40, (byte)0xE0, (byte)0xBC, (byte)0x65, (byte)0xFE,
(byte)0x8F, (byte)0x46, (byte)0x07, (byte)0x02, (byte)0x82, (byte)0xF0, (byte)0x23, (byte)0x43,
(byte)0xB4, (byte)0x30, (byte)0x44, (byte)0x84, (byte)0xD3, (byte)0x48, (byte)0x0B, (byte)0x56,
(byte)0x87, (byte)0xC6, (byte)0x33, (byte)0x08, (byte)0x04, (byte)0x0E, (byte)0xC1, (byte)0xDB,
(byte)0xF6, (byte)0xD1, (byte)0xAF, (byte)0xD6, (byte)0xF9, (byte)0x7A, (byte)0x9A, (byte)0x2D,
(byte)0x3C, (byte)0x39, (byte)0x79, (byte)0x73, (byte)0xE8, (byte)0xA1, (byte)0x96, (byte)0xC6,
(byte)0x6F, (byte)0x08, (byte)0xFD, (byte)0x1D, (byte)0x88, (byte)0x1E, (byte)0xF5, (byte)0xA5,
(byte)0x8A, (byte)0x0A, (byte)0xCE, (byte)0x5E, (byte)0xC6, (byte)0x54, (byte)0x6E, (byte)0x08,
(byte)0x5B, (byte)0x39, (byte)0xEB, (byte)0x5C, (byte)0xDA, (byte)0x06, (byte)0x24, (byte)0x69,
(byte)0x95, (byte)0xF3, (byte)0xF9, (byte)0x3E, (byte)0x15, (byte)0x01, (byte)0x40, (byte)0x14,
(byte)0x6F, (byte)0xF7, (byte)0x71, (byte)0x5C, (byte)0x97, (byte)0xB5, (byte)0xAC, (byte)0x1B,
(byte)0xB9, (byte)0x46, (byte)0x68, (byte)0x74, (byte)0x9D, (byte)0x51, (byte)0x64, (byte)0xF7,
(byte)0xCA, (byte)0x9F, (byte)0xBB, (byte)0x0E, (byte)0xE5, (byte)0x36, (byte)0x74, (byte)0xB5,
(byte)0xD1, (byte)0xAA, (byte)0x7D, (byte)0x10, (byte)0x0E, (byte)0x69, (byte)0xB7, (byte)0x0B,
(byte)0xF5, (byte)0x57, (byte)0x71, (byte)0x87, (byte)0x41, (byte)0x74, (byte)0x92, (byte)0x8F,
(byte)0xB7, (byte)0xBA, (byte)0x5F, (byte)0xDD, (byte)0xEC, (byte)0xF6, (byte)0x1D, (byte)0x0A,
(byte)0xB2, (byte)0x16, (byte)0x5C, (byte)0x8D, (byte)0x2F, (byte)0xF3, (byte)0xF5, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x49, (byte)0x45, (byte)0x4E, (byte)0x44, (byte)0xAE,
(byte)0x42, (byte)0x60, (byte)0x82
},
(int)0,
(int)1779
);
}
ImmutableImage From File
/*--------------------------------------------------
* ImmutableImageFromFile.java
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ImmutableImageFromFile extends MIDlet implements CommandListener
{
private Display display; // Reference to Display object
private Form fmMain; // The main form
private Command cmExit; // Command to exit the MIDlet
public ImmutableImageFromFile()
{
display = Display.getDisplay(this);
cmExit = new Command("Exit", Command.EXIT, 1);
fmMain = new Form("");
fmMain.addCommand(cmExit);
fmMain.setCommandListener(this);
try
{
// Read the appropriate image based on color support
Image im = Image.createImage((display.isColor()) ?
"/image_color.png":"/image_bw.png");
// Code Block A
fmMain.append("A1");
fmMain.append(new ImageItem(null, im, ImageItem.LAYOUT_NEWLINE_BEFORE |
ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_NEWLINE_AFTER, null));
fmMain.append("A2");
// Code Block B
// fmMain.append("B1");
// fmMain.append(new ImageItem(null, im,ImageItem.LAYOUT_NEWLINE_BEFORE |
// ImageItem.LAYOUT_LEFT |ImageItem.LAYOUT_NEWLINE_AFTER, null));
// fmMain.append("B2");
// Code Block C
// fmMain.append("C1");
// fmMain.append(new ImageItem(null, im,ImageItem.LAYOUT_NEWLINE_BEFORE |
// ImageItem.LAYOUT_RIGHT |ImageItem.LAYOUT_NEWLINE_AFTER, null));
// fmMain.append("C2");
// Code Block D
// fmMain.append("D1");
// fmMain.append(im);
// fmMain.append("D2");
// System.out.println("Layout Directives:" + ((ImageItem)fmMain.get(1)).getLayout());
display.setCurrent(fmMain);
}
catch (java.io.IOException e)
{
System.err.println("Unable to locate or read .png file");
}
}
public void startApp()
{
display.setCurrent(fmMain);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s)
{
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
MutableImage
/*--------------------------------------------------
* MutableImage.java
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MutableImage extends MIDlet implements CommandListener
{
private Display display; // Reference to display object
private Form fmMain; // Main form
private Command cmExit; // Command to exit the MIDlet
private static final String message = "Core J2ME";
public MutableImage()
{
display = Display.getDisplay(this);
// Create a mutable image and get graphics object for image
Image tmpImg = Image.createImage(80, 20);
Graphics graphics = tmpImg.getGraphics();
// Specify a font face, style and size
Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_MEDIUM);
graphics.setFont(font);
// Center the text in the image
graphics.drawString(message,
(tmpImg.getWidth() / 2) - (font.stringWidth(message) / 2), 0,
Graphics.TOP | Graphics.LEFT);
// Draw a rectangle around the image
graphics.drawRect(0,0, tmpImg.getWidth()-1, tmpImg.getHeight()-1);
cmExit = new Command("Exit", Command.EXIT, 1);
fmMain = new Form("");
fmMain.addCommand(cmExit);
fmMain.setCommandListener(this);
// Convert the image to immutable and add to the form
fmMain.append(Image.createImage(tmpImg));
display.setCurrent(fmMain);
}
public void startApp()
{
display.setCurrent(fmMain);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s)
{
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
Mutable Image Example
//jad file (please verify the jar size)
/*
MIDlet-Name: MutableImageExample
MIDlet-Version: 1.0
MIDlet-Vendor: MyCompany
MIDlet-Jar-URL: MutableImageExample.jar
MIDlet-1: MutableImageExample, , MutableImageExample
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
MIDlet-JAR-SIZE: 100
*/
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.rumand;
import javax.microedition.lcdui.rumandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
public class MutableImageExample extends MIDlet {
private Display display;
private MyCanvas canvas;
public MutableImageExample() {
display = Display.getDisplay(this);
canvas = new MyCanvas(this);
}
protected void startApp() {
display.setCurrent(canvas);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
public void exitMIDlet() {
destroyApp(true);
notifyDestroyed();
}
public Display getDisplay() {
return display;
}
}
class MyCanvas extends Canvas implements CommandListener {
private Command exit;
private MutableImageExample mutableImageExample;
private Image image = Image.createImage(70, 70);
public MyCanvas(MutableImageExample mutableImageExample) {
this.mutableImageExample = mutableImageExample;
exit = new Command("Exit", Command.EXIT, 1);
addCommand(exit);
setCommandListener(this);
Graphics graphics = image.getGraphics();
graphics.setColor(255, 0, 0);
graphics.fillArc(10, 10, 60, 50, 180, 180);
}
protected void paint(Graphics graphics) {
graphics.setColor(255, 255, 255);
graphics.fillRect(0, 0, getWidth(), getHeight());
graphics.drawImage(image, 30, 30, Graphics.VCENTER | Graphics.HCENTER);
}
public void commandAction(Command command, Displayable display) {
if (command == exit) {
mutableImageExample.exitMIDlet();
}
}
}
View Png 2
/*--------------------------------------------------
* ViewPng2.java
*
* Download and view a png file
*
* Same as pngView.java with the exception that the
* connection to the server is through an
* InputStream versus ContentConnection
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
public class ViewPng2 extends MIDlet implements CommandListener
{
private Display display;
private TextBox tbMain;
private Form fmViewPng;
private Command cmExit;
private Command cmView;
private Command cmBack;
public ViewPng2()
{
display = Display.getDisplay(this);
// Create the Main textbox with a maximum of 75 characters
tbMain = new TextBox("Enter url", "http://www.corej2me.ru/midpbook_v1e1/ch14/duke.png", 75, 0);
// Create commands and add to textbox
cmExit = new Command("Exit", Command.EXIT, 1);
cmView = new Command("View", Command.SCREEN, 2);
tbMain.addCommand(cmExit);
tbMain.addCommand(cmView );
// Set up a listener for textbox
tbMain.setCommandListener(this);
// ---------------------------------------
// Create the form that will hold the png image
fmViewPng = new Form("");
// Create commands and add to form
cmBack = new Command("Back", Command.BACK, 1);
fmViewPng.addCommand(cmBack);
// Set up a listener for form
fmViewPng.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(tbMain);
}
public void pauseApp()
{ }
public void destroyApp(boolean unconditional)
{ }
/*--------------------------------------------------
* Process events
*-------------------------------------------------*/
public void commandAction(Command c, Displayable s)
{
// If the Command button pressed was "Exit"
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
else if (c == cmView)
{
// Delete everything from the form
if (fmViewPng.size() > 0)
for (int i = 0; i < fmViewPng.size(); i++)
fmViewPng.delete(i);
// Download image and set as the first (only) item on the form
Image im;
try
{
if ((im = getImage(tbMain.getString())) != null)
{
ImageItem ii = new ImageItem(null, im, ImageItem.LAYOUT_DEFAULT, null);
// If there is already an image, set (replace) it
if (fmViewPng.size() != 0)
fmViewPng.set(0, ii);
else // Append the image to the empty form
fmViewPng.append(ii);
}
else
fmViewPng.append("Unsuccessful download.");
// Display the form with the image
display.setCurrent(fmViewPng);
}
catch (Exception e)
{
System.err.println("Msg: " + e.toString());
}
}
else if (c == cmBack) {
display.setCurrent(tbMain);
}
}
/*--------------------------------------------------
* Open connection and download png into a byte array.
*-------------------------------------------------*/
private Image getImage(String url) throws IOException
{
InputStream iStrm = (InputStream) Connector.openInputStream(url);
Image im = null;
try
{
ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
// Place into image array
byte imageData[] = bStrm.toByteArray();
// Create the image from the byte array
im = Image.createImage(imageData, 0, imageData.length);
}
finally
{
// Clean up
if (iStrm != null)
iStrm.close();
}
return (im == null ? null : im);
}
}
View Png Thread
/*--------------------------------------------------
* ViewPngThread.java
*
* Download and view a png file. The download is
* done in the background with a separate thread
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.ru
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
public class ViewPngThread extends MIDlet implements CommandListener
{
private Display display;
private TextBox tbMain;
private Alert alStatus;
private Form fmViewPng;
private Command cmExit;
private Command cmView;
private Command cmBack;
private static final int ALERT_DISPLAY_TIME = 3000;
Image im = null;
public ViewPngThread()
{
display = Display.getDisplay(this);
// Create the Main textbox with a maximum of 75 characters
tbMain = new TextBox("Enter url", "http://www.corej2me.ru/midpbook_v1e1/ch14/bird.png", 75, 0);
// Create commands and add to textbox
cmExit = new Command("Exit", Command.EXIT, 1);
cmView = new Command("View", Command.SCREEN, 2);
tbMain.addCommand(cmExit);
tbMain.addCommand(cmView );
// Set up a listener for textbox
tbMain.setCommandListener(this);
// Create the form that will hold the png image
fmViewPng = new Form("");
// Create commands and add to form
cmBack = new Command("Back", Command.BACK, 1);
fmViewPng.addCommand(cmBack);
// Set up a listener for form
fmViewPng.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(tbMain);
}
public void pauseApp()
{ }
public void destroyApp(boolean unconditional)
{ }
/*--------------------------------------------------
* Process events
*-------------------------------------------------*/
public void commandAction(Command c, Displayable s)
{
// If the Command button pressed was "Exit"
if (c == cmExit)
{
destroyApp(false);
notifyDestroyed();
}
else if (c == cmView)
{
// Show alert indicating we are starting a download.
// This alert is NOT modal, it appears for
// approximately 3 seconds (see ALERT_DISPLAY_TIME)
showAlert("Downloading", false, tbMain);
// Create an instance of the class that will
// download the file in a separate thread
Download dl = new Download(tbMain.getString(), this);
// Start the thread/download
dl.start();
}
else if (c == cmBack)
{
display.setCurrent(tbMain);
}
}
/*--------------------------------------------------
* Called by the thread after attempting to download
* an image. If the parameter is "true" the download
* was successful, and the image is shown on a form.
* If parameter is "false" the download failed, and
* the user is returned to the textbox.
*
* In either case, show an alert indicating the
* the result of the download.
*-------------------------------------------------*/
public void showImage(boolean flag)
{
// Download failed...
if (flag == false)
{
// Alert followed by the main textbox
showAlert("Download Failure", true, tbMain);
}
else // Successful download...
{
ImageItem ii = new ImageItem(null, im, ImageItem.LAYOUT_DEFAULT, null);
// If there is already an image, set (replace) it
if (fmViewPng.size() != 0)
fmViewPng.set(0, ii);
else // Append the image to the empty form
fmViewPng.append(ii);
// Alert followed by the form holding the image
showAlert("Download Successful", true, fmViewPng);
}
}
/*--------------------------------------------------
* Show an alert with the parameters determining
* the type (modal or not) and the displayable to
* show after the alert is dismissed
*-------------------------------------------------*/
public void showAlert(String msg, boolean modal, Displayable displayable)
{
// Create alert, add text, associate a sound
alStatus = new Alert("Status", msg, null, AlertType.INFO);
// Set the alert type
if (modal)
alStatus.setTimeout(Alert.FOREVER);
else
alStatus.setTimeout(ALERT_DISPLAY_TIME);
// Show the alert, followed by the displayable
display.setCurrent(alStatus, displayable);
}
}
/*--------------------------------------------------
* Class - Download
*
* Download an image file in a separate thread
*-------------------------------------------------*/
class Download implements Runnable
{
private String url;
private ViewPngThread MIDlet;
private boolean downloadSuccess = false;
public Download(String url, ViewPngThread MIDlet)
{
this.url = url;
this.MIDlet = MIDlet;
}
/*--------------------------------------------------
* Download the image
*-------------------------------------------------*/
public void run()
{
try
{
getImage(url);
}
catch (Exception e)
{
System.err.println("Msg: " + e.toString());
}
}
/*--------------------------------------------------
* Create and start the new thread
*-------------------------------------------------*/
public void start()
{
Thread thread = new Thread(this);
try
{
thread.start();
}
catch (Exception e)
{
}
}
/*--------------------------------------------------
* Open connection and download png into a byte array.
*-------------------------------------------------*/
private void getImage(String url) throws IOException
{
ContentConnection connection = (ContentConnection) Connector.open(url);
// * There is a bug in MIDP 1.0.3 in which read() sometimes returns
// an invalid length. To work around this, I have changed the
// stream to DataInputStream and called readFully() instead of read()
// InputStream iStrm = connection.openInputStream();
DataInputStream iStrm = connection.openDataInputStream();
ByteArrayOutputStream bStrm = null;
Image im = null;
try
{
// ContentConnection includes a length method
byte imageData[];
int length = (int) connection.getLength();
if (length != -1)
{
imageData = new byte[length];
// Read the png into an array
// iStrm.read(imageData);
iStrm.readFully(imageData);
}
else // Length not available...
{
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
}
// Create the image from the byte array
im = Image.createImage(imageData, 0, imageData.length);
}
finally
{
// Clean up
if (connection != null)
connection.close();
if (iStrm != null)
iStrm.close();
if (bStrm != null)
bStrm.close();
}
// Return to the caller the status of the download
if (im == null)
MIDlet.showImage(false);
else
{
MIDlet.im = im;
MIDlet.showImage(true);
}
}
}