Instance Method

decodeBytesForKey:returnedLength:

Decodes a stream of bytes associated with a given key.

Declaration

- (const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp;

Parameters

key

A key in the archive within the current decoding scope. key must not be nil.

lengthp

Upon return, contains the number of bytes returned.

Return Value

The stream of bytes associated with the key key. Returns NULL if key does not exist.

Discussion

The returned value is a pointer to a temporary buffer owned by the receiver. The buffer goes away with the unarchiver, not the containing autorelease pool block. You must copy the bytes into your own buffer if you need the data to persist beyond the life of the receiver.

See Also

Decoding Data

- containsValueForKey:

Returns a Boolean value that indicates whether the archive contains a value for a given key within the current decoding scope.

- decodeBoolForKey:

Decodes a Boolean value associated with a given key.

- decodeDoubleForKey:

Decodes a double-precision floating-point value associated with a given key.

- decodeFloatForKey:

Decodes a single-precision floating-point value associated with a given key.

- decodeIntForKey:

Decodes an integer value associated with a given key.

- decodeInt32ForKey:

Decodes a 32-bit integer value associated with a given key.

- decodeInt64ForKey:

Decodes a 64-bit integer value associated with a given key.

- decodeObjectForKey:

Decodes and returns an object associated with a given key.

- finishDecoding

Tells the receiver that you are finished decoding objects.

decodingFailurePolicy

The action to take when this unarchiver fails to decode an entry.