Ojbect-C2 6、NSFileHandle 和NSFileManager 的使用

Properties

readabilityHandler

The block to use for reading the contents of the file handle asynchronously.

@property (copy) void (^readabilityHandler)( NSFileHandle *);
Discussion

The default value of this property is nil. Assigning a valid block object to this property creates a dispatch source for reading the contents of the file or socket. Your block is submitted to the file handle’s dispatch queue when there is data to read. When reading a file, your handler block is typically executed repeatedly until the entire contents of the file have been read. When reading data from a socket, your handler block is executed whenever there is data on the socket waiting to be read.

The block you provide must accept a single parameter that is the current file handle. The return type of your block should be void.

To stop reading 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.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSFileHandle.h

writeabilityHandler

The block to use for writing the contents of the file handle asynchronously.

@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.

The block you provide must accept a single parameter that is the current file handle. The return type of your block should be 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.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSFileHandle.h






NSFILEMANAGER

Tasks

Creating a File Manager

Locating System Directories

Locating Application Group Container Directories

Discovering Directory Contents

Creating and Deleting Items

Moving and Copying Items

Managing ICloud-Based Items

Creating Symbolic and Hard Links

Determining Access to Files

Getting and Setting Attributes

Getting and Comparing File Contents

Converting File Paths to Strings

Managing the Delegate

Managing the Current Directory

Deprecated Methods




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值