picofuse-objc

Instance Methods | Class Methods | List of all members
NXData Class Reference

Bytes, which can be added to. More...

#import <Foundation/Foundation.h>

Inheritance diagram for NXData:
Inheritance graph
[legend]
Collaboration diagram for NXData:
Collaboration graph
[legend]

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...
 

Detailed Description

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.

Definition at line 21 of file NXData.h.

Method Documentation

◆ appendBytes:length:()

- (BOOL) appendBytes: (const void *)  bytes
length: (size_t)  length 

Adds bytes to the end.

Returns
YES if they were added, or NO if there isn't enough memory, or the bytes are NULL but the length isn't zero.

◆ appendData:()

- (BOOL) appendData: (NXData *)  data

Adds the bytes of other data to the end, which can be this data.

Returns
YES if they were added, or NO if there isn't enough memory.

◆ copy()

- (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.

◆ dataWithBase64String:()

+ (id) dataWithBase64String: (NXString *)  string

Returns the bytes encoded in base64.

Parameters
stringThe 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.
Returns
The data, or nil if it isn't base64 or there isn't enough memory.

◆ dataWithBytes:length:()

+ (id) dataWithBytes: (const void *)  bytes
length: (size_t)  length 

Returns a copy of some bytes.

Parameters
bytesThe bytes, or NULL if the length is zero.
lengthThe number of bytes.
Returns
The data, or nil if there isn't enough memory, or the bytes are NULL but the length isn't zero.

◆ dataWithCapacity:()

+ (id) dataWithCapacity: (size_t)  capacity

Returns empty data with room for a number of bytes.

Returns
The data, or nil if there isn't enough memory.

◆ dataWithString:()

+ (id) dataWithString: (NXString *)  string

Returns a copy of the bytes of a string, which are its UTF-8, without a terminating zero.

Parameters
stringThe string, or nil for no bytes.
Returns
The data, or nil if there isn't enough memory.

◆ hashWithAlgorithm:()

- (NXData *) hashWithAlgorithm: (NXHashAlgorithm)  algorithm

Returns a hash of the bytes, as data.

Returns
The hash, or nil if it isn't available or there isn't enough memory. The bytes are hashed where they are, without a copy.

The documentation for this class was generated from the following file: