I noticed that when you compress data they can compress multiple files and since all files are made up of bytes how do these compression algorithms keep track of them? What seperators do they use?
From my understanding it goes like this, for example I have an array [1,2,3] and another array [4,12,6] and I store them in as a string "1234126" these algorithms can keep track of their original form so when you decompress it still goes "1234126" → "[1,2,3]","[4,12,6]" how do compression algorithms do these?
My only solution for these is not as efficient → [1,2,3] would be converted to 111213
so when I decompress I know the length of the number for example : 111213 → [0] = 1 so next number has length of 1 which is [1] = 1 and so on.. but I don't think this is efficient as it bloats data, and if it goes beyond "9" you'd need to add another number for example the word "this is a data"
has a length of 14 so before I compress this it would be → 214this is a data
then proceed to compression which would be bloated. Is this how compression algorithms do stuff like this?
steps:
file1 has this is a data from file1
, file2 has this is a data from file2
→ encode data from both files → 214this is a data from file1214this is a data from file2
→ compress → result : 776^&676s
→ decompress "776^&676s" → 214this is a data from file1214this is a data from file2
→ decode → file1 has this is a data from file1
and file2 has this is a data from file2
I hope this question isn't so confusing :)