I am retrieving a fairly large amount of text from a webpage and I would like to build multiple NSMutableData instances with it, of a certain size each. What I am not sure about is how to move on to the second NSMutableData object once the first one fills up. What I want to do is similar to this:
NSInteger dataSize = 1000;
data1 = [[NSMutableData alloc] initWithCapacity:dataSize];
data2 = [[NSMutableData alloc] initWithCapacity:dataSize];
data2 = [[NSMutableData alloc] initWithCapacity:dataSize];
if (//data3 is full) {
[data2 appendData:data];
} else if (// Data2 is full) {
[data1 appendData:data];
} else {
[data3 appendData:data];
}
Or some thing else along those lines. Any suggestions on how I might do this? How does one determine if the NSMutableData object is at capacity?