I want to “override” or “switch” some bytes (say the first 2048 bytes from the file) with another bytes array, in a file which size is 100MB.
I don’t want to read the whole file, because it takes a critic time for me to go over the whole file.
What I’ve tried so far:
FileOutputStream out = new FileOutputStream(file);
out.getChannel().write(buffer, position);
The new buffer array is in the same size.
I’m developing with java + eclipse Android application which need to to that.
I’ll be glad if someone could write me a piece of code that do the job.
Thanks in advance.
This overwrites the first 2048 bytes of the file with the contents of the
dataarray.