If you are trying to include an image to your program at design time, you can do this in Eclipse as follows:
Create a Source Folder in your project. Right-click Project
> New
> Source Folder
. Copy your image there. From there, you can internally load the image as follows:
InputStream input = classLoader.getResourceAsStream("arquivo.ext");
If you want to do this programmatically, you have at least two options:
Via javax.imageio
:
Image image = null;
try {
URL url = new URL("http://www.website.com/arquivo.ext");
image = ImageIO.read(url);
} catch (IOException e) {
}
Via Sockets
/ stream
:
URL url = new URL("http://www.website.com/arquivo.ext");
InputStream in = new BufferedInputStream(url.openStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int n = 0;
while (-1!=(n=in.read(buf)))
{
out.write(buf, 0, n);
}
out.close();
in.close();
byte[] response = out.toByteArray();
FileOutputStream fos = new FileOutputStream("C://arquivo.ext");
fos.write(response);
fos.close();
Enjoying, the URLs you posted appear to be local. As a suggestion, post on some image hosting service, such as Snag.gy .