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

closeFile()

Disallows further access to the represented file or communications channel and signals end of file on communications channels that permit writing. 表現されたファイルまたは通信経路へのもっと先のアクセスを禁止します、そして書き込み許可する通信経路上のファイルの終端を合図します。

Declaration 宣言

func closeFile()

Discussion 議論

If the file handle object owns its file descriptor, it automatically closes that descriptor when it is deallocated. If you initialized the file handle object using the init(fileDescriptor:) method, or you initialized it using the init(fileDescriptor:closeOnDealloc:) and passed false for the flag parameter, you can use this method to close the file descriptor; otherwise, you must close the file descriptor yourself. ファイルハンドルオブジェクトがそれのファイル記述子を所有するならば、それはその記述子をそれがデアロケートされる時に自動的に閉じます。あなたがファイルハンドルオブジェクトをinit(fileDescriptor:)メソッドを使って初期化したならば、またはあなたがそれをinit(fileDescriptor:closeOnDealloc:)を使って初期化したそしてfalseflagパラメータに渡したならば、あなたはこのメソッドを使ってファイル記述子を閉じることができます;そうでなければ、あなたはファイル記述子をあなた自身で閉じなければなりません。

After calling this method, you may still use the file handle object but must not attempt to read or write data or use the object to operate on the file descriptor. Attempts to read or write a closed file descriptor raise an exception. このメソッドを呼び出した後、あなたはまだファイルハンドルオブジェクトを使うかもしれません、しかしデータの読み込みや書き出しまたはそのオブジェクトを使ってファイル記述子上で演算を試みてはいけません。閉じられたファイル記述子での読み込みや書き出しの試みは、例外を引き起こします。

See Also 参照

Deprecated 非推奨