You can only rewrite subsets of a file like that if you put there the same amount of bytes. To be more clear, if you want to simply fit in there a bigger file than the subset size you're considering, it won't work.
If you want to replace a file in the package with another that is the same size , just rewrite that region with any File access API. If its smaller, you can rewrite it from byte 0 and leave the remaining space unused. If its bigger, the quickest way is to move all bytes that follow that region forward, and then fit the file in there.
I think the only other option is to just rebuild the entire package.