Class
public class Skachivaniye { public void Skachivaniye(String AdresProgrammServera, String AdresProgrammKliyenta) { try { Sardine Sardina = SardineFactory.begin("login", "password"); InputStream VkhodnoyPotok = Sardina.get("https://webdav.yandex.ru" + AdresProgrammServera); File Fayl = new File(AdresProgrammKliyenta); OutputStream VykhodnoyPotok = new FileOutputStream(Fayl); byte[] Bufer = new byte[8 * 1024]; int ChteniyeBufrea; while((ChteniyeBufrea = VkhodnoyPotok.read(Bufer)) != -1) { VykhodnoyPotok.write(Bufer, 0, ChteniyeBufrea); } VkhodnoyPotok.close(); VykhodnoyPotok.close(); out.println("\n\n Скачано"); } catch(FileNotFoundException Isklyucheniye) { out.println("\n\n Ошибка"); out.println("\n " + Isklyucheniye.getMessage()); } catch(IOException Isklyucheniye) { out.println("\n\n Ошибка"); out.println("\n " + Isklyucheniye.getMessage()); } } } Class call
Skachivaniye Skachivaniye = new Skachivaniye(); out.print("\n Авест"); Skachivaniye.Skachivaniye("/" + "Скрипты%2C%20Сверка%20и%20Avest" + "/" + "Avest.zip", AdresProgramm.AdresProgramm + "\\" + "Avest.zip"); out.print("\n Формирование"); Skachivaniye.Skachivaniye("/" + ObyektProgram.Obyekt1 + "/" + ObyektProgram.Obyekt2.replaceAll(" ", "%20") + ".zip", AdresProgramm.AdresProgramm + "\\" + ObyektProgram.Obyekt2.replaceAll("%20", " ") + ".zip"); out.print("\n Сверка"); Skachivaniye.Skachivaniye("/" + "Скрипты%2C%20Сверка%20и%20Avest" + "/" + "Сверка%20ЭСЧФ.zip", AdresProgramm.AdresProgramm + "\\" + "Сверка ЭСЧФ.zip"); out.print("\n Инструкции"); Skachivaniye.Skachivaniye("/" + "Скрипты%2C%20Сверка%20и%20Avest" + "/" + "Инструкция%20по%20работе%20с%20ЭСЧФ.doc", AdresProgramm.AdresProgramm + "\\" + "Инструкция по работе с ЭСЧФ.doc"); Skachivaniye.Skachivaniye("/" + "Скрипты%2C%20Сверка%20и%20Avest" + "/" + "Установка%20(если%20ничего%20установлено%20не%20было).txt", AdresProgramm.AdresProgramm + "\\" + "Установка (если ничего установлено не было).txt"); Console
Download
Avest
Downloaded
Formation
Downloaded
Reconciliation
Downloaded
14, 2017 10:58:45 AM com.github.sardine.impl.io.HttpMethodReleaseInputStream close WARNING: Abort connection for response HttpResponseProxy {HTTP / 1.1 200 OK webdav8o, X-Content-Type-Options: nosniff, Transfer-Encoding: chunked, Server: MochiWeb / 1.0, Last-Modified: Tue, 14 Mar 2017 07:24:03 GMT, Keep-Alive: timeout = 300, Etag: b995cc623edcfe7884425af925fa4aa1, Date: Tue, 14 Mar 2017 07:58:35 GMT, Content-Type: application / msword, Content-Disposition: attachment; filename = "% D0% 98% D0% BD% D1% 81% D1% 82% D1% 80% D1% 83% D0% BA% D1% 86% D0% B8% D1% 8F% 20% D0% BF% D0% BE% 20% D1% 80% D0% B0% D0% B1% D0% BE% D1% 82% D0% B5% 20% D1% 81% 20% D0% AD% D0% A1% D0% A7% D0% A4.doc ", Accept-Ranges: bytes] org.apache.http.client.entity.DecompressingEntity@59d016c9}
Downloaded
Downloaded
Why do I get this warning and how to remove it? Files swing.
Code from class
if (log.isLoggable(Level.WARNING)) { log.warning(String.format("Abort connection for response %s", response)); } // Close an HTTP response as quickly as possible, avoiding consuming // response data unnecessarily though at the expense of making underlying // connections unavailable for reuse. // The response proxy will force close the connection. ((CloseableHttpResponse) response).close();
@SuppressWarnings("unchecked")- Evgeny Tupikov