How can I split my file into data blocks and move these blocks from my Android application?

I want to be able to transfer blocks of my file instead of the full file from my inorder application to transfer it more efficiently. What is the best way to do this?

Update

Here is an example of where I need this approach: Let's say I have a 4 GB file that I am trying to upload. If the network failed, my file download will stop and I will have to start from scratch. Instead, if I keep track of blocks that I have already transferred, I can continue with blocks that have not yet been transferred. This is especially important for weak network connections.

+6
source share
3 answers

I figured out one approach to do this. What you can do is split the file into blocks using the approach mentioned here - How to split a file into pieces using Java? and convert each block to a Base64 string, and then pass the encoded string. The server responds with the block number after receiving it. Then this fragment number can be saved locally on the device, and the next fragment can be sent to the server. After all the pieces have been transferred, Base64 decoding can be done on the server side, and the files can be combined.

+1
source

I think his understanding is that the OS transfers the file in a very random way, and he wants to programmatically control what to transfer and how much to transfer

+1
source

Can I find out which file you have. "I ask because if it is not a text file, then I think you need meu law and the law or G711 or G729 .

+1
source

Source: https://habr.com/ru/post/983820/


All Articles