package com.utils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class HttpUtil {
public static synchronized void downloadData(String url, String target) {
try {
org.apache.commons.io.FileUtils.copyURLToFile(new URL(url), new File(target));
} catch (IOException ex) {
System.err.println("errore " + ex.getMessage());
}
}
}
poi semplicemente:
HttpUtil.downloadData("https://chart.googleapis.com/chart?cht=qr&chs=100x100&chl=http://www.google.it", "/home/marco/qrcode.png");
la documentazione di Google
Nessun commento:
Posta un commento