Bytes, which can be added to. More...
#import <Foundation/Foundation.h>


Instance Methods | |
| (id) | - initWithCapacity: |
| Initializes empty data with room for a number of bytes. | |
| (id) | - initWithBytes:length: |
| Initializes a copy of some bytes. | |
| (id) | - initWithBase64String: |
| Initializes the bytes encoded in base64. | |
| (size_t) | - length |
| Returns the number of bytes. | |
| (size_t) | - capacity |
| Returns the number of bytes there's room for, before more memory is needed. | |
| (const void *) | - bytes |
| Returns the bytes, which are only valid until the data is changed or deallocated, or NULL if there are none. | |
| (BOOL) | - appendBytes:length: |
| Adds bytes to the end. More... | |
| (BOOL) | - appendData: |
| Adds the bytes of other data to the end, which can be this data. More... | |
| (NXString *) | - base64String |
| Returns the bytes encoded in base64, in the standard alphabet of RFC 4648 with "=" padding, or nil if there isn't enough memory. | |
| (NXData *) | - hashWithAlgorithm: |
| Returns a hash of the bytes, as data. More... | |
| (BOOL) | - isEqual: |
| Returns YES if another object is data with the same bytes. | |
| (uintptr_t) | - hash |
| Returns a hash of the bytes, which is the same for equal data. | |
| (id) | - copy |
| Returns new data with the same bytes, or nil if there isn't enough memory. More... | |
| (NXString *) | - description |
| Returns the bytes in hexadecimal, such as "<0a1b2c>". | |
Instance Methods inherited from NXObject | |
| (void) | - dealloc |
| Frees the instance. More... | |
| (NXZone *) | - zone |
| Returns the zone in which the instance was allocated. More... | |
| (id) | - retain |
| Increases the retain count of the receiver. More... | |
| (void) | - release |
| Decreases the retain count of the receiver. More... | |
| (id) | - autorelease |
| Releases the receiver later, when the current autorelease pool of the thread is drained. More... | |
Instance Methods inherited from Object | |
| (id) | - init |
| Initialize the instance, after allocation. More... | |
| (Class) | - class |
| Returns the class of the instance. More... | |
| (Class) | - superclass |
| Returns the superclass of the instance. More... | |
| (BOOL) | - isKindOfClass: |
| Returns a Boolean value that indicates whether the receiver is an instance of a given class. More... | |
| (BOOL) | - conformsTo: |
| Checks if the receiver's class conforms to a protocol. More... | |
Instance Methods inherited from <ObjectProtocol> | |
| (BOOL) | - respondsToSelector: |
| Checks if the receiver responds to a selector. More... | |
Class Methods | |
| (id) | + data |
| Returns empty data. | |
| (id) | + dataWithCapacity: |
| Returns empty data with room for a number of bytes. More... | |
| (id) | + dataWithBytes:length: |
| Returns a copy of some bytes. More... | |
| (id) | + dataWithBase64String: |
| Returns the bytes encoded in base64. More... | |
| (id) | + dataWithString: |
| Returns a copy of the bytes of a string, which are its UTF-8, without a terminating zero. More... | |
Class Methods inherited from NXObject | |
| (id) | + alloc |
| Allocates a new instance in the default zone, or if there isn't one, with sys_calloc(). More... | |
| (id) | + allocWithZone: |
| Allocates a new instance in a specific zone. More... | |
| (id) | + new |
| Allocates and initializes a new instance, as [[cls alloc] init] does. More... | |
Class Methods inherited from Object | |
| (void) | + initialize |
| Performs one-time initialization for the class. More... | |
| (Class) | + class |
| Returns the class object. More... | |
| (Class) | + superclass |
| Returns the superclass of the class. More... | |
| (const char *) | + name |
| Returns the name of the class. More... | |
| (BOOL) | + conformsTo: |
| Checks if the class conforms to a protocol. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Object | |
| Class | isa |
| A pointer to the object's class structure. More... | |
Bytes, which can be added to.
The bytes can be any value, including zero. They're kept one after another in memory from the zone of the data, which is twice as big when more room is needed.
Any number of threads can read data at once, but while one changes it, no other thread can use it, and it doesn't lock itself. See Threads and mutable objects.
| - (BOOL) appendBytes: | (const void *) | bytes | |
| length: | (size_t) | length | |
Adds bytes to the end.
Adds the bytes of other data to the end, which can be this data.
| - (id) copy |
Returns new data with the same bytes, or nil if there isn't enough memory.
The caller owns it and has to release it.
Implements NXObject.
Returns the bytes encoded in base64.
| string | The whole of it is base64, in the standard alphabet of RFC 4648, with or without "=" padding. Nothing else is allowed, such as spaces or line breaks. |
| + (id) dataWithBytes: | (const void *) | bytes | |
| length: | (size_t) | length | |
Returns a copy of some bytes.
| bytes | The bytes, or NULL if the length is zero. |
| length | The number of bytes. |
| + (id) dataWithCapacity: | (size_t) | capacity |
Returns empty data with room for a number of bytes.
Returns a copy of the bytes of a string, which are its UTF-8, without a terminating zero.
| string | The string, or nil for no bytes. |
| - (NXData *) hashWithAlgorithm: | (NXHashAlgorithm) | algorithm |
Returns a hash of the bytes, as data.