korhan-Ö
11/5/2016 - 9:28 AM

#Http

URL url = new URL("http://www.yurtarama.com/" + turu.attr("src"));
    InputStream in = new BufferedInputStream(url.openStream());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] buf = new byte[4096];
    int n = 0;
    while (-1!=(n=in.read(buf)))
    {
        out.write(buf, 0, n);
    }
    out.close();
    in.close();
    byte[] response = out.toByteArray();
    String urlPrefix = "/Users/korhanozbek/Desktop/" + "yurt/";
    String photoUrl = URLInformation.get(i).substring(25, URLInformation.get(i).length() - 10) + "_" + j + ".jpg";
    FileOutputStream fos = new FileOutputStream(urlPrefix + photoUrl);
    fos.write(response);
    fos.close();