Android 下载 断点续传

来源:互联网 发布:金融一体机软件系统 编辑:程序博客网 时间:2024/05/21 08:39

  By naikus

  // Open connection to URL.

    HttpURLConnection connection =
            (HttpURLConnection) url.openConnection();

    // Specify what portion of file to download.
    connection.setRequestProperty("Range", "bytes=" + downloaded + "-");
    // here "downloaded" is the data length already previously downloaded.

    // Connect to server.
    connection.connect();


原创粉丝点击