ensureCapacity
Ensures the array has enough space to store the requested number of bytes.
Declaration
virtual unsigned int ensureCapacity(
unsigned intnewCapacity);Parameters
- newCapacity:
The total number of bytes the OSData object should be able to store.
Return Value
Returns the new capacity of the OSData object, which may be different from the number requested (if smaller, reallocation of storage failed).
Overview
This function immediately resizes the OSData's buffer, if necessary, to accommodate at least newCapacity bytes. If newCapacity is not greater than the current capacity, or if an allocation error occurs, the original capacity is returned.
There is no way to reduce the capacity of an OSData.
An OSData object created "NoCopy" does not allow resizing.
See Also
Miscellaneous
appendByteappendBytes(const OSData *)appendBytes(const void *, unsigned int)freegetBytesNoCopy()getBytesNoCopy(unsigned int, unsigned int)getCapacitygetCapacityIncrementgetLengthinitWithBytesinitWithBytesNoCopyinitWithCapacityinitWithData(const OSData *)initWithData(const OSData *, unsigned int, unsigned int)isEqualTo(const OSData *)isEqualTo(const OSMetaClassBase *)isEqualTo(const OSString *)isEqualTo(const void *, unsigned int)serializesetCapacityIncrementwithByteswithBytesNoCopywithCapacitywithData(const OSData *)withData(const OSData *, unsigned int, unsigned int)