Instance Method インスタンスメソッド

readInBackgroundAndNotify

Reads from the file or communications channel in the background and posts a notification when finished. バックグラウンドにおいてファイルまたは通信経路から読み込みます、そして終了した時ある通知を投函します。

Declaration 宣言

- (void)readInBackgroundAndNotify;

Discussion 議論

This method performs an asynchronous availableData operation on a file or communications channel and posts an NSFileHandleReadCompletionNotification notification on the current thread when that operation is complete. You must call this method from a thread that has an active run loop. このメソッドは、非同期availableData演算をファイルまたは通信経路上で実行します、そしてNSFileHandleReadCompletionNotification通知を現在のスレッド上で、その演算が完了する場合に投函します。あなたは、このメソッドをアクティブ実行ループを持つスレッドから呼び出さなければなりません。

The length of the data is limited to the buffer size of the underlying operating system. The notification includes a userInfo dictionary that contains the data read; access this object using the NSFileHandleNotificationDataItem key. データの長さは、基底オペレーティングシステムのバッファサイズに制限されます。通知は、読み込まれたデータを収容するuserInfo辞書を含んでいます;このオブジェクトにNSFileHandleNotificationDataItemキーを使ってアクセスしてください。

Any object interested in receiving this data asynchronously must add itself as an observer of NSFileHandleReadCompletionNotification. In communication via stream-type sockets, the receiver is often the object returned in the userInfo dictionary of NSFileHandleConnectionAcceptedNotification. 非同期にこのデータを受け取ることに興味を持っているあらゆるオブジェクトは、それ自身をNSFileHandleReadCompletionNotificationのオブザーバとして追加しなければなりません。ストリーム型ソケット経由の通信において、レシーバはしばしばNSFileHandleConnectionAcceptedNotificationuserInfo辞書において返されるオブジェクトです。

Note that this method does not cause a continuous stream of notifications to be sent. If you wish to keep getting notified, you’ll also need to call readInBackgroundAndNotify in your observer method. このメソッドは、通知の途切れないストリームが送られるようにすることに注意してください。あなたが通知され続けるのを願うならば、あなたはまたreadInBackgroundAndNotifyをあなたのオブザーバメソッドにおいて呼び出す必要があります。

See Also 参照

Reading Asynchronously with Notifications 通知で非同期に読み出す

Related Documentation 関連文書