Mac Developer Library

Developer

Foundation Framework Reference NSPortCoder Class Reference

Options
Deployment Target:

On This Page
Language:

NSPortCoder

NSPortCoder is a concrete subclass of NSCoder used in the distributed objects system to transmit object proxies (and sometimes objects themselves) between NSConnection objects. An NSPortCoder instance is always created and used by an NSConnection object; you should never need to explicitly create or use one directly yourself.

  • Creates and returns a new NSPortCoder object.

    Declaration

    Objective-C

    + (id)portCoderWithReceivePort:(NSPort *)receiverPort sendPort:(NSPort *)sendPort components:(NSArray *)components

    Parameters

    receiverPort

    The receiver port.

    sendPort

    The send port.

    components

    An array containing an encoded distributed objects message.

    Return Value

    A new NSPortCoder object connected to the communication ports receiverPort and sendPort, with an encoded distributed objects message stored in components.

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.7.

  • Initializes and returns an NSPortCoder object.

    Declaration

    Objective-C

    - (id)initWithReceivePort:(NSPort *)receiverPort sendPort:(NSPort *)sendPort components:(NSArray *)components

    Parameters

    receiverPort

    The receive port.

    sendPort

    The send port.

    components

    An array containing an encoded distributed objects message.

    Discussion

    Initializes a newly allocated NSPortCoder object connected to the communication ports receiverPort and sendPort, with an encoded distributed objects message stored in components.

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.7.

  • - connection (OS X v10.7)

    Returns the NSConnection object that uses the receiver.

    Declaration

    Objective-C

    - (NSConnection *)connection

    Return Value

    The NSConnection object that uses the receiver. In an object’s encodeWithCoder: method, this is the sending (server) connection. In initWithCoder: this is the receiving (client) connection.

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.7.

  • Encodes a given port so it can be properly reconstituted in the receiving process or thread.

    Declaration

    Objective-C

    - (void)encodePortObject:(NSPort *)aPort

    Parameters

    aPort

    The port to encode.

    Discussion

    This method is primarily for use by NSPort objects themselves—you can always use the general encode...Object: methods to encode any object.

    NSPort invokes this method in its encodeWithCoder: method so that the appropriate kernel information for the port can be encoded. A subclass of NSPortCoder should not encode an NSPort by sending it an encodeWithCoder: message. See Subclassing NSCoder for more information.

    Availability

    Available in OS X v10.0 and later.

  • Decodes and returns an NSPort object that was previously encoded with any of the general encode...Object: messages.

    Declaration

    Objective-C

    - (NSPort *)decodePortObject

    Return Value

    An NSPort object that was previously encoded with any of the general encode...Object: messages.

    Discussion

    This method is primarily for use by NSPort objects themselves—you can always use decodeObject to decode any object.

    NSPort invokes this method in its initWithCoder: method so the appropriate kernel information for the port can be decoded. A subclass of NSPortCoder shouldn’t decode an NSPort by sending it an initWithCoder: message. See Subclassing NSCoder for more information.

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value that indicates whether the receiver is encoding an object by copying it.

    Declaration

    Objective-C

    - (BOOL)isBycopy

    Return Value

    YEStrue if the receiver is encoding an object by copying it, NOfalse if it expects a proxy.

    Discussion

    See Distributed Objects Programming Topics for more information.

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isByref

  • Returns a Boolean value that indicates whether the receiver is encoding an object by reference.

    Declaration

    Objective-C

    - (BOOL)isByref

    Return Value

    YEStrue if the receiver is encoding an object byref, NOfalse if it expects a copy.

    Discussion

    See Distributed Objects Programming Topics for more information.

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isBycopy