iOS 基础类解析 - NSData、NSMutableData
iOS 基础类解析 - NSData、NSMutableData
太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es)
本文遵循“署名-非商业用途-保持一致”创作公用协议
NSData Class Reference
| Inherits from | |
| Conforms to | |
| Framework |
/System/Library/Frameworks/Foundation.framework
|
| Availability |
Available in iOS 2.0 and later.
|
| Declared in |
NSData.h
|
| Companion guides | |
| Related sample code |
Overview
NSData and its mutable subclass NSMutableData provide
data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects.
NSData creates static data objects, and NSMutableData creates
dynamic data objects. NSData and NSMutableData are typically used for data storage and are
also useful in Distributed Objects applications, where data contained in data objects can be copied or moved between applications.
The size of the data is subject to a theoretical limit of about 8 ExaBytes (in practice, the limit should not be a factor).
NSData is “toll-free bridged” with its Core Foundation counterpart, CFDataRef.
See “Toll-Free
Bridging” for more information on toll-free bridging.
Tasks
Creating Data Objects
+ data+ dataWithBytes:length:+ dataWithBytesNoCopy:length:+ dataWithBytesNoCopy:length:freeWhenDone:+ dataWithContentsOfFile:+ dataWithContentsOfFile:options:error:+ dataWithContentsOfURL:+ dataWithContentsOfURL:options:error:+ dataWithData:– initWithBase64EncodedData:options:– initWithBase64EncodedString:options:– initWithBytes:length:– initWithBytesNoCopy:length:– initWithBytesNoCopy:length:deallocator:– initWithBytesNoCopy:length:freeWhenDone:– initWithContentsOfFile:– initWithContentsOfFile:options:error:– initWithContentsOfURL:– initWithContentsOfURL:options:error:– initWithData:– initWithBase64Encoding:Deprecated
in iOS 7.0+ dataWithContentsOfMappedFile:Deprecated
in iOS 5.0– initWithContentsOfMappedFile:Deprecated
in iOS 5.0
Accessing Data
– bytes– description– enumerateByteRangesUsingBlock:– getBytes:length:– getBytes:range:– subdataWithRange:– rangeOfData:options:range:– getBytes:Deprecated
in iOS 4.0
Base-64 Encoding
– base64EncodedDataWithOptions:– base64EncodedStringWithOptions:– base64EncodingDeprecated
in iOS 7.0
Testing Data
Storing Data
Copyright © 2014 Apple Inc. All Rights Reserved. Terms of Use | Privacy
Policy | Updated: 2014-02-11
iOS 基础类解析 - NSData、NSMutableData的更多相关文章
- iOS 基础类解析 - NSDate
版权声明:本文为博主原创文章,未经博主同意不得转载.转载联系 QQ 30952589,加好友请注明来意. https://blog.csdn.net/sleks/article/details/248 ...
- iOS 基础类解析 - NSString、NSMutableString
iOS 基础类解析 - NSString 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 ...
- IOS 原生解析JSON 问题
服务器----WebService 返回的是JSON数据 IOS解析报错: Error Domain=NSCocoaErrorDomain Code=3840 "Unable to conv ...
- 【译】UI设计基础(UI Design Basics)--iOS应用解析(iOS App Anatomy)(三)
2.1 iOS应用解析(iOS App Anatomy) 几乎所有的iOS应用都会用到UIKit框架中的组件.了解这些基础组件的名称,角色,功能可以帮你在应用界面设计时做出更好的决策. UIKit提 ...
- iOS中解析 XML / JSON
JSON数据格式 1. 概述: JSON (JavaScript Object Notation) 是⼀一种轻量级的数据交换格式 基于⽂文本格式,易于⼈人阅读和编写,同时也易于机器解析和⽣生成. 2. ...
- IOS 文件解析
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java ...
- iOS书摘之Objective-C编程之道 iOS设计模式解析
来自<Objective-C编程之道iOS设计模式解析>一书的摘要总结 一.Prototype 原型模式 定义:使用原型实例指定创建对象的种类,并通过复制这个原型创建新的对象.(<设 ...
- iOS NSDictionary、NSData、JSON数据类型相互转换
iOS经常需要用到数据类型的转换,下面列举一下常用类型的转换. 1.NSDictionary类型转换为NSData类型: //NSDictionary -> NSData: NSDictiona ...
- IOS数据解析JSON
//非原创 作为一种轻量级的数据交换格式,json正在逐步取代xml,成为网络数据的通用格式. 有的json代码格式比较混乱,可以使用此“http://www.bejson.com/”网站来进行JSO ...
随机推荐
- SCOI2014总结
似乎还没有写过SCOI的总结,今天补上,权当填坑. PS:CDQZ的看到了不要到处黑 SCOI-2014应该算是我的小高考,感觉拿住一本招的瓶颈就在这里.加之NOIp只有400分有点拖后腿,所以很早就 ...
- hdu2026(water~~)
http://acm.hdu.edu.cn/showproblem.php?pid=2026 #include<iostream> #include<stdio.h> #inc ...
- linux下tomcat启动正常,但是外部浏览器无法访问
这种情况一般是由于系统防火墙设置问题导致的,这次遇到的系统是centos 7.2,防火墙由iptables改成了firewall,因此停止防火墙的命令应该是: systemctl disable fi ...
- 4星|《JAC写给外贸公司老板的企管书》:善总结爱学习、有业绩的老外贸的经验谈
作者从事外贸10余年,作出了业绩,也善总结.爱学习.爱分享.本书是作者在外贸行业的从业经验集.有一些战略方面的,比如开发小语种市场,大部分都是战术方面的操作细节(比如如何做营销),应该是非常适合从业者 ...
- 15个最受欢迎的Python开源框架(转)
原文地址:http://blog.jobbole.com/72306/ Django: Python Web应用开发框架 Django 应该是最出名的Python框架,GAE甚至Erlang都有框架受 ...
- 错误处理:vmware下克隆centos7配置静态ip地址网卡问题
vmware下克隆centos7,在配置静态ip地址,重启网卡存在问题,还是mac地址问题 ip addr show 查看下mac地址,配置文件修改下,重启网卡正常了
- PAC代理语法含义与书写规范
一直以来使用ShadowSocksFQ,基本上默认的PAC代理模式己能满足所需,实在个别pac不方便的就转成用全局代理模式也能愉快FQ. 只是最近学习前端的知识,需要FQ访问 MDN web docs ...
- parseInt()函数
parseInt()转化整形是从左往右,取出第一个整型,如:10a10b,则显示10: //20170719补充 如果该字符串第一个字符是0,那么该字符串会基于八进制而非十进制来求值,在八进制中,8和 ...
- Sprinboot优雅配置监听,并记录所有启动事件
在阅读Springboot启动源码的时候,发现Springboot自动启动listeners是通过uopeizhi文件配置的,本文就是采用Springboot方式自动装入listeners. 项目依赖 ...
- windows 小知识---windows下生成公钥和私钥
首先Windows操作系统需要安装git. 安装完成后,再到任意的文件夹内,点击右键.选择git bash here 打开之后,输入ssh-keygen,一路按enter键. 全部结束后,再到C:\U ...