Hi all,
The task Im trying to accomplish is converting one file type to another by inserting some data (bytes) into the file, and by insert data, I mean insert bytes into random offsets in the file, i.e. bringing up the file size.
Ive struggled with this for a while, since it doesnt seem you can insert data into a FileStream, only overwrite existing data.
Anyway, Im not exactly asking for code at this point, but more or less the logic behind what Im trying to do.
I have considered these methods:
a. Take each "part" of the file from the source FileStream, manipulate each "part," and write the parts of the file one-by-one to an empty MemoryStream, eventually saving the MemoryStream to a converted file.
b. Forget streams and convert the file to a byte array and insert the necessary bytes into the array (I have little experience here, Ive always been a stream guy).
Before I begin, I would simply like to know which method would be more suitable to what Im doing so that I dont regret it after x lines of code.
Thanks in advance!
View the full article
The task Im trying to accomplish is converting one file type to another by inserting some data (bytes) into the file, and by insert data, I mean insert bytes into random offsets in the file, i.e. bringing up the file size.
Ive struggled with this for a while, since it doesnt seem you can insert data into a FileStream, only overwrite existing data.
Anyway, Im not exactly asking for code at this point, but more or less the logic behind what Im trying to do.
I have considered these methods:
a. Take each "part" of the file from the source FileStream, manipulate each "part," and write the parts of the file one-by-one to an empty MemoryStream, eventually saving the MemoryStream to a converted file.
b. Forget streams and convert the file to a byte array and insert the necessary bytes into the array (I have little experience here, Ive always been a stream guy).
Before I begin, I would simply like to know which method would be more suitable to what Im doing so that I dont regret it after x lines of code.
Thanks in advance!
View the full article