开发者

Must I close the File Handle when doing this?

Example:

NSData *fileData = [fileHandle开发者_开发问答 readDataToEndOfFile];

Am I responsible for closing that file handle? (I think I'm not...but just 99.95% sure!)


You are not required to close the file handle, however, it is good practice to deallocate the NSFileHandle object when you are finished with it. This will ensure that the memory used by the application is kept to a minimum.

iOS Class Reference:

Note: The deallocation of an NSFileHandle object deletes its descriptor and closes the represented file or channel unless the NSFileHandle object was created with initWithFileDescriptor: or initWithFileDescriptor:closeOnDealloc: with NO as the parameter argument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜