AEStreamClose(_:_:)
Closes and deallocates an AEStreamRef.
Declaration
func AEStreamClose(_ ref: AEStreamRef!, _ desc: UnsafeMutablePointer<AEDesc>!) -> OSStatusParameters
- ref:
An Aestreamrefcontaining the stream data.
- desc:
A pointer to a descriptor for receiving a the stream data, or
NULLif you want to discard the data. See Aedesc.
Return Value
A result code. See Result Codes.
Discussion
Use this function to dispose of an AEStreamRef you created using AEStreamCreateEvent(_:_:_:_:_:_:_:), AEStreamOpen(), or AEStreamOpenEvent(_:). To retrieve the resulting descriptor from the stream prior to disposal, pass in a pointer to an AEDesc structure in the desc parameter. If this parameter exists, AEStreamClose fills in the descriptor with the stream data. If the stream contains invalid information, possibly due to improperly balanced calls to “AEStream” functions, the returned descriptor type is set to typeNull.
Regardless of any errors returned by this function, it is always safe to call AEDisposeDesc(_:) on the returned descriptor.
Specifying NULL for the desc parameter causes AEStreamClose to discard the stream data and dispose of the AEStreamRef. When you call AEStreamClose in this way, you do not need to worry about balancing nested calls to “AEStream” functions. This technique is particularly useful during error-handling situations where you need to dispose of a stream but do not know its exact state.
See Also
Creating Apple Event Structures Using Streams
AEStreamCloseDesc(_:)AEStreamCloseList(_:)AEStreamCloseRecord(_:)AEStreamCreateEvent(_:_:_:_:_:_:_:)AEStreamOpen()AEStreamOpenDesc(_:_:)AEStreamOpenEvent(_:)AEStreamOpenKeyDesc(_:_:_:)AEStreamOpenList(_:)AEStreamOpenRecord(_:_:)AEStreamOptionalParam(_:_:)AEStreamSetRecordType(_:_:)AEStreamWriteAEDesc(_:_:)AEStreamWriteData(_:_:_:)AEStreamWriteDesc(_:_:_:_:)AEStreamWriteKey(_:_:)AEStreamWriteKeyDesc(_:_:_:_:_:)