Assuming you are using HTTP for download, you will want to use the HTTP HEAD http and RANGE http headers.
HEAD will give you the file size (if available), and then RANGE allows you to load a range of bytes.
Once you have the file size, divide it into pieces of the same size and find the download stream for each fragment. Once done, write the file fragments in the correct order.
If you don't know how to use the RANGE header, here is another SO answer explaining how: fooobar.com/questions/398866 / ...
[EDIT]
To make the file in pieces, use this and start the download process,
private void getBytesFromFile(File file) throws IOException { FileInputStream is = new FileInputStream(file); //videorecorder stores video to file java.nio.channels.FileChannel fc = is.getChannel(); java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocate(10000); int chunkCount = 0; byte[] bytes; while(fc.read(bb) >= 0){ bb.flip(); //save the part of the file into a chunk bytes = bb.array(); storeByteArrayToFile(bytes, mRecordingFile + "." + chunkCount);//mRecordingFile is the (String)path to file chunkCount++; bb.clear(); } } private void storeByteArrayToFile(byte[] bytesToSave, String path) throws IOException { FileOutputStream fOut = new FileOutputStream(path); try { fOut.write(bytesToSave); } catch (Exception ex) { Log.e("ERROR", ex.getMessage()); } finally { fOut.close(); } }
source share