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:
– base64Encoding
Deprecated
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 ...
随机推荐
- ACM_小Z的A+B
小Z的A+B Time Limit: 2000/1000ms (Java/Others) Problem Description: 小Z最喜欢A+B了,没事就研究研究,比如什么大整数A+B(就是100 ...
- 6.11---multipartfile在哪个jar包下---6.11---uuid---swagger上传图片包错去掉注解响应体
<dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupl ...
- Sql Server 优化 SQL 查询:如何写出高性能SQL语句
1. 首先要搞明白什么叫执行计划? 执行计划是数据库根据SQL语句和相关表的统计信息作出的一个查询方案,这个方案是由查询优化器自动分析产生的,比如一条SQL语句如果用来从一个 10万条记录的表中查1条 ...
- R语言开发环境的搭建
1.R语言的下载 https://mirrors.tuna.tsinghua.edu.cn/CRAN/ 2.R语言的安装 安装完后,打开R Console 输入 pie(c(0.9, 0.2, 0.3 ...
- (转)学习淘淘商城第二十二课(KindEditor富文本编辑器的使用)
http://blog.csdn.net/u012453843/article/details/70184155 上节课我们一起学习了怎样解决KindEditor富文本编辑器上传图片的浏览器兼容性问题 ...
- 如何在Android Studio中查看一个类的继承关系呢?
在面板顶部的工具栏中,找到Navigate,然后在下拉列表中,找到“Type Hierarchy”(快捷键 Ctrl+H),点击.即可在面板右侧出现该类的Hierarchy层级图.
- Redis 之order set有序集合结构及命令详解
1.zadd key score1 value1 score2 value2 添加元素 2.zrem key value1 value2 .. 删除集合中的元素 3.zremrangebyscor ...
- CAD处理键盘被按下事件(com接口VB语言)
主要用到函数说明: MxDrawXCustomEvent::KeyDown 键盘被按下,详细说明如下: 参数 说明 LONG lVk 是按钮码,如F8,的值为#define VK_F8 0x77 返回 ...
- Linux快速入门教程-进程管理ipcs命令学习
使用Linux系统必备的技能之一就是Linux进程管理,系统运行的过程正是无数进程在运行的过程.这些进程的运行需要占用系统的内存等资源,做好系统进程的管理,对于我们合理分配.使用系统资源有非常大的意义 ...
- 数组题汇总(python3)
题目主要来自<剑指offer>和LeetCode,用python3来写的代码. 1.二维数组的查找: 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列 ...