“arquivo de imagem de download java” Respostas de código

arquivo de imagem de download java

 URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
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();
DreamCoder

arquivo de imagem de download java

(throws IOException)

Image image = null;
try {
    URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
    image = ImageIO.read(url);
} catch (IOException e) {
}
DreamCoder

arquivo de imagem de download java

URL url = new URL("http://upload.wikimedia.org/wikipedia/commons/9/9c/Image-Porkeri_001.jpg");
InputStream in = new BufferedInputStream(url.openStream());
OutputStream out = new BufferedOutputStream(new FileOutputStream("Image-Porkeri_001.jpg"));

for ( int i; (i = in.read()) != -1; ) {
    out.write(i);
}
in.close();
out.close();
DreamCoder

Respostas semelhantes a “arquivo de imagem de download java”

Perguntas semelhantes a “arquivo de imagem de download java”

Mais respostas relacionadas para “arquivo de imagem de download java” em Java

Procure respostas de código populares por idioma

Procurar outros idiomas de código