I’d like to know if there is a way to use NSInputStream
to read chunk of data with some offset. For example there is a file with size 100MB, I need chunks with size of 10MB but I need the 5th chunk before the 1st chunk.
The goal is to be able to upload large files to a server. The backend expects chunks of data, that can be sent at once. The idea is to use NSOperationQueue
and to set maxConcurrentOperationCount
to 5 for example. Each of the tasks will need different chunk to send. I know about - (NSData *)subdataWithRange:(NSRange)range
- but this will require the whole NSData
to be in the memory all the time. Which won’t work with large files, so I’d prefer to use NSInputStream
. Can the chunks be read out of order with NSInputStream
and how or should another approach be used?