Type Property 型プロパティ

nullDevice

The file handle associated with a null device.

Declaration 宣言

class var nullDevice: FileHandle { get }

Return Value 戻り値

A file handle associated with a null device. nullデバイスと結び付けられたファイルハンドル。

Discussion 議論

You can use null-device file handles as “placeholders” for standard-device file handles or in collection objects to avoid exceptions and other errors resulting from messages being sent to invalid file handles. Read messages sent to a null-device file handle return an end-of-file indicator (an empty NSData object) rather than raise an exception. Write messages are no-ops, whereas fileDescriptor returns an illegal value. Other methods are no-ops or return “sensible” values. あなたは、nullデバイスファイルハンドルを標準デバイスファイルハンドルに対してまたはコレクションオブジェクトにおいて「プレースホルダ」として使って、無効なファイルハンドルにメッセージを送る結果である例外および他のエラーを回避してください。nullデバイスファイルハンドルに送られた読み込みメッセージは、ファイル終端指示子(空のNSDataオブジェクト)を返します、例外を引き起こすのではなく。書き込みメッセージはノーオペレーションです、fileDescriptorは不正な値を返すけれども。他のメソッドは、ノーオペレーションか「分別ある」値を返します。

When using this method to create a file handle object, the file handle owns its associated file descriptor and is responsible for closing it. このメソッドを使ってファイルハンドルオブジェクトを作成する場合、ファイルハンドルは、それの結び付けられたファイル記述子を所有し、そしてそれを閉じることに責任を持ちます。

See Also 参照

Getting a File Handle ファイルハンドルを取得する

Related Documentation 関連文書