Reputation: 1684
A certain piece of code works like this:
Now, for files like 10 or 100 mb in size, this works just fine and maintains a consistent rate of processing bytes per second (so processing a 100 mb file will take 10x the 10 mb one). If I go up to say 1.5 gigs, then the system has to keep 2 of those in memory so it starts swapping to disk and that brings the speed down dramatically.
So I thought maybe the following was possible:
My question is:
Upvotes: 1
Views: 978
Reputation: 6036
What you want to do is entirely possible. Your questions demand an answer that's a bit lengthy, so I refer you to this web page:
Note that the examples in the page deal with files. You can set up a buffer to the size you want and read as many bytes as you want at a time. You'll even see an opportune place for you to call your encryption routine.
With the NSMutableData instance you create, you can then have it write out to disk using -writeToFile:atomically:
or -writeToURL:atomically:
Give it a try, and best wishes to you in your endeavors.
Upvotes: 1