import java.lang.*;
import java.io.*;
import java.net.*;
//http://sgm.metropoliglobal.com/fotos/206.jpg
class fig
{
public static void main(String [] args)
{
int dato;
int i=0;
FileOutputStream fos=null ;
DataOutputStream dos=null ;
try
{
fos=new FileOutputStream("c:\\I.jpg");
dos=new DataOutputStream(fos);
URL servidor = new URL("http://sgm.metropoliglobal.com/fotos/206.jpg");
URLConnection descargarImagen = servidor.openConnection();
DataInputStream imagen = new DataInputStream(descargarImagen.getInputStream());
while(true)
{
dato=imagen.readUnsignedByte();
dos.writeByte(dato);
}
}
catch (MalformedURLException e)
{
System.out.println("Error:MalformedURLException");
}
catch (IOException e)
{
System.out.println("");
}
try
{
if(fos!=null)
{
fos.close();
dos.close();
}
}
catch(IOException e)
{
System.out.println("Error2");
}
}
}