Idea: Use HttpGet to add header head, in the head to set the scope of reading content, so that the server sends the data is not from the beginning, the customer service side using a single-threaded to open a file, each time the data are appended to the file, so that the file's breakpoint download.
Server Code Snippet:
// set the downloaded data location xx bytes to xx bytes New Basicheader ("Range", "bytes=" + size + "-" + fileSize); Request.addheader (header_size);
// set the downloaded data location xx bytes to xx bytes New Basicheader ("Range", "bytes=" + size + "-" ); Request.addheader (header_size);
Client code snippet:
New true ); // tips to open the file output stream in an additional way, you can implement a breakpoint download, true append, false to not append the contents of the source file is replaced directly
One of the implementation scenarios for Android breakpoint continuation