private void getImage(String url) throws IOException {
ContentConnection connection =(ContentConnection)Connector.open(url);
DataInputStream iStream = connection.openDataInputStream();
ByteArrayOutputStream bStream = null;
Image im = null;
try{
byte imageData[];
int length =(int)connection.getLength();
if(length!=-1){
imageData = new byte[length];
iStream.readFully(imageData);
}else{
bStream = new ByteArrayOutputStream();
int ch;
while((ch = iStream.read())!=-1){
bStream.write(ch);
}
imageData = bStream.toByteArray();
}
im = Image.createImage(imageData,0,imageData.length);
}finally{
if(connection!=null){
connection.close();
}
if(iStream!=null){
iStream.close();
}
if(bStream!=null){
bStream.close();
}
if(im == null){
Midlet.showImage(false);
}
else{
Midlet.im = im;
Midlet.showImage(true);
}
}
ContentConnection connection =(ContentConnection)Connector.open(url);
DataInputStream iStream = connection.openDataInputStream();
ByteArrayOutputStream bStream = null;
Image im = null;
try{
byte imageData[];
int length =(int)connection.getLength();
if(length!=-1){
imageData = new byte[length];
iStream.readFully(imageData);
}else{
bStream = new ByteArrayOutputStream();
int ch;
while((ch = iStream.read())!=-1){
bStream.write(ch);
}
imageData = bStream.toByteArray();
}
im = Image.createImage(imageData,0,imageData.length);
}finally{
if(connection!=null){
connection.close();
}
if(iStream!=null){
iStream.close();
}
if(bStream!=null){
bStream.close();
}
if(im == null){
Midlet.showImage(false);
}
else{
Midlet.im = im;
Midlet.showImage(true);
}
}