Inherits from NSObject
Declared in DTBonjourDataChunk.h

Overview

This class represents an object that is being transmitted as a chunk of data comprised of a header and the raw data.

Properties

numberOfTransferredBytes

Number of bytes that have been transferred already

@property (nonatomic, readonly) NSUInteger numberOfTransferredBytes

Declared In

DTBonjourDataChunk.h

sequenceNumber

Sequence number of this chunk on the connection

@property (nonatomic, readonly) NSUInteger sequenceNumber

Declared In

DTBonjourDataChunk.h

totalBytes

Number of bytes of the receiver

@property (nonatomic, readonly) NSUInteger totalBytes

Declared In

DTBonjourDataChunk.h

Instance Methods

decodedObject

Decodes the object contained in the received data.

- (id)decodedObject

Discussion

Note: You should only call this method once transmission is complete.

Declared In

DTBonjourDataChunk.h

initForReading

Creates a data chunk meant for receiving.

- (id)initForReading

Declared In

DTBonjourDataChunk.h

initWithObject:encoding:error:

Creates a data chunk meant for sending.

- (id)initWithObject:(id)object encoding:(DTBonjourDataConnectionContentType)encoding error:(NSError **)error

Parameters

object

An object to be encoded and transmitted

encoding

The transport encoding to be used for encoding the object

error

An optional error output parameter for when the object cannot be encoded

Declared In

DTBonjourDataChunk.h

isTransmissionComplete

YES if all bytes have been written/read

- (BOOL)isTransmissionComplete

Return Value

YES if all bytes have been written/read

Declared In

DTBonjourDataChunk.h

readFromInputStream:

Reads from the input stream and initializes the header and payload as the necessary data becomes available.

- (NSInteger)readFromInputStream:(NSInputStream *)stream

Parameters

stream

The input stream to read from

Return Value

The number of bytes read. -1 means that there was an error.

Declared In

DTBonjourDataChunk.h

writeToOutputStream:

Writes the as many bytes to the output stream as it would accept

- (NSInteger)writeToOutputStream:(NSOutputStream *)stream

Parameters

stream

The output stream to write to

Return Value

The number of bytes written. -1 means that there was an error.

Declared In

DTBonjourDataChunk.h