Instance Property インスタンスプロパティ

writeabilityHandler

The block to use for writing the contents of the file handle asynchronously. 非同期にファイルハンドルの内容を書き込むために使うブロック。

Declaration 宣言

@property(copy) void (^writeabilityHandler)(NSFileHandle *);

Discussion 議論

The default value of this property is nil. Assigning a valid Block object to this property creates a dispatch source for writing the contents of the file or socket. Your block is submitted to the file handle’s dispatch queue when there is room available to write more data. When writing a file, your handler block is typically executed repeatedly until the entire contents of the file have been written. When writing data to a socket, your handler block is executed whenever the socket is ready to accept more data. このプロパティの省略時の値はnilです。有効なBlockオブジェクトをこのプロパティに割り当てることは、ファイルまたはソケットの内容を書き出すためのディスパッチソースを作成します。あなたのブロックは、もっとデータを書き込むのに利用可能なあき場所がある場合、ファイルハンドルの持つディスパッチキューに提出されます。ファイルを書き出す場合、あなたのハンドラブロックはたいてい、ファイルの内容全体が書き出されてしまうまで繰り返して実行されます。ソケットにデータを書き出す場合、ソケットがもっとデータを受け取る準備ができた時はいつでも、あなたのハンドラブロックは実行されます。

The block you provide must accept a single parameter that is the current file handle. The return type of your block should be void. あなたが提供するブロックは、現在のファイルハンドルであるただ1つのパラメータだけを受け取らなければなりません。あなたのブロックの戻り型は、voidであるべきです。

To stop writing data to the file or socket, set the value of this property to nil. Doing so cancels the dispatch source and cleans up the file handle’s structures appropriately. ファイルまたはソケットへの書き出しを停止するには、このプロパティの値をnilに設定してください。そうすることは、ディスパッチソースを取り消して、ファイルハンドラの持つ構造体を適切に片付けます。

See Also 参照

Monitoring for Readability and Writability 読み出し可能性と書き込み可能性を監視する