i compress an xml file using some compression technique (e.g. bzip2). i check the size of the compressed data in memory.
then i write this compressed data into a file. more data gets written into the file than was intended. the size of the file shows that it has more data than size of the compressed data in memory.
e.g. length of string in memory: 13k
write this string into a file, its size is reported as 20k in the file.
read the contents of this file into memory, and check the size, it shows 13k!
this doesn't happen to original data that has not been compressed. also, if i encode the compressed file, then it doesnt show this problem. note that when the compressed file is encoded, it no longer remains binary data.
my guess is that this has something to do with binary data since compression produces binary data.
i want to keep the compressed data as it is, even when i write it into the file i want it to be exactly the same as it is in memory.
maybe i am missing something very fundamental.
any pointers/solution will really help.
thanks.