Java me 如何将图像从计算机(Web服务器)下载到手机?

Java me 如何将图像从计算机(Web服务器)下载到手机?,java-me,Java Me,我想使用JavaJ2ME将照片从计算机Web服务器下载到手机移动设备。如何实现这一点?使用此方法并传递下载URL private Image getImage(String url) throws IOException { ContentConnection connection = (ContentConnection) Connector.open(url); DataInputStream iStrm = connection.openDataInputStream(

我想使用JavaJ2ME将照片从计算机Web服务器下载到手机移动设备。如何实现这一点?

使用此方法并传递下载URL

private Image getImage(String url) throws IOException
  {
    ContentConnection connection = (ContentConnection) Connector.open(url);
    DataInputStream iStrm = connection.openDataInputStream();
    ByteArrayOutputStream bStrm = null;    
    Image im = null;

    try
    {
      byte imageData[];
      int length = (int) connection.getLength();
      if (length != -1)
      {
        imageData = new byte[length];  
        iStrm.readFully(imageData);
      } else {       
        bStrm = new ByteArrayOutputStream();
        int ch;
        while ((ch = iStrm.read()) != -1)
          bStrm.write(ch);
        imageData = bStrm.toByteArray();
        bStrm.close();                
      }
      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);
  }

如果url目录中有多张照片怎么办?