I want to be able to determine if the number of bytes in an instance of NSMutableData is equal to zero. How would I do this?
+5
A:
Simple:
if([data length] == 0) {
//do something
}
where data is your NSMutableData object.
NSMutabledData inherits from NSData, so it gains all of the members of NSData.
JonathonW
2009-07-12 04:51:18
“…all of the members of NSData.” NSData is neither a C++ class nor a C structure, so it has no members. As an Objective-C class, what it has are instance variables and methods, and some other classes also have properties. The difference is not as trivial as it may seem; consider Objective-C++, which has both Objective-C classes (with ivars and methods and properties) and C++ classes (with members).
Peter Hosey
2009-07-12 05:26:42