Skip to content

support resuming of file transfers#125

Open
laole918 wants to merge 1 commit intokevinsawicki:masterfrom
laole918:master
Open

support resuming of file transfers#125
laole918 wants to merge 1 commit intokevinsawicki:masterfrom
laole918:master

Conversation

@laole918
Copy link
Copy Markdown

        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