Skip to content

Conversation

laole918
Copy link

        File path = new File("/Users/laole918/Downloads/HttpUtils");
        File meizi = new File(path, "meizi.jpg");
        String meiziUrl = "http://i.meizitu.net/2013/08/131Z5K41-0.jpg";
        int contentLength = HttpRequest.get(meiziUrl).contentLength();
        int unitLength = contentLength / 2;
        if (unitLength > 0) {
            int unitOverLength = contentLength % 2;
            for (int i = 0, j = 0; i < contentLength && j < 1; i += unitLength, j++) {
                int end = i + unitLength;
                HttpRequest.get(meiziUrl).range(i, (j == 1) ? end + unitOverLength : end).receive(meizi, i);
            }
        }

support resuming of file transfers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant