Type Method 型メソッド

fileHandleForUpdatingURL:error:

Returns a file handle initialized for reading and writing to the file, device, or named socket at the specified URL. 指定されたURLでのファイル、デバイス、または名前付きソケットの読み書きのために初期化されるファイルハンドルを返します。

Declaration 宣言

+ (instancetype)fileHandleForUpdatingURL:(NSURL *)url 
                                   error:(NSError * _Nullable *)error;

Parameters パラメータ

url

The URL of the file, device, or named socket to access. アクセスするファイル、デバイス、または名前付きソケットのURL。

error

If an error occurs, upon return contains an NSError object that describes the problem. Pass NULL if you do not want error information. エラーが発生するならば、戻りでは、問題を記述するNSErrorオブジェクトを含みます。NULLをあなたがエラー情報を望まないならば渡してください。

Return Value 戻り値

The initialized file handle object or nil if no file exists at url. 初期化されたファイルハンドルオブジェクトまたは、ファイルがurlで存在しないならばnil

Discussion 議論

The file pointer is set to the beginning of the file. The returned object responds to both NSFileHandleread... messages and writeData:. ファイルポインタは、ファイルの始まりに設定されます。返されるオブジェクトはNSFileHandleread...メッセージとwriteData:の両方に応答します。

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 参照

Creating a File Handle ファイルハンドルを作成する

Related Documentation 関連文書