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 ...
随机推荐
- 51nod1565 FFT
思路: 显然拆位FFT 不解释 //By SiriusRen #include <bits/stdc++.h> using namespace std; ; ); ,L,S,T,k,sa[ ...
- 启用禁用USB接口
一个小工具,功能有启用禁用外网.USB接口,可由服务端socket长链接进行操控客户端从而达到实现前边的这些功能,这里贴上核心代码,先给上启用禁用USB接口吧,这个方法可随时启用禁用,之前用过一个改u ...
- JS压缩图片(canvas),返回base64码
上传图片时总会遇到图片过大上传不上去的问题,本方法是在网上搜的压缩图片的例子,我测试过了,确实能用,但是照搬别人的代码,发现压缩后图片会失真,不清晰,现经修改图片清晰度还可以,不仔细看差别不大,so, ...
- [Windows Server 2008] Apache+PHP安全设置
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:Win2008 ...
- windows phone 8 使用页面传对象的方式 实现页面间的多值传递
在做windows phone 开发的时候,会经常碰到页面间之间的跳转和传递数据,如果传递的值不多,只有两三个,我们通常使用NavigationService.Navigate(new Uri(&qu ...
- POJ 3070 - 快速矩阵幂求斐波纳契数列
这题并不复杂. 设$A=\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}$ 由题中公式: $\begin{pmatrix}f(n+1) & ...
- 【sqli-labs】 less59 GET -Challenge -Double Query -5 queries allowed -Variation2 (GET型 挑战 双查询 只允许5次查询 变化2)
整型的注入 http://192.168.136.128/sqli-labs-master/Less-59/?id=1 or UpdateXml(1,concat(0x7e,database(),0x ...
- Quartz实战
https://my.oschina.net/yinxiaoling/blog/542336?fromerr=s3ko7u33 Quartz实战 > 一.内存型(1) <bean name ...
- 配置tfs2017的agent
tfs支持四种验证方式,分别是:PAT.Negotiate.Integrated.Alternate 我们使用Negotiate方式 首先,登录tfs服务器,设置iis的身份验证 添加一个Negot ...
- PHP 魔术方法浅谈
php中把以两个下划线(__)开头的方法称之为魔术方法.魔术方法包括: __construct() 类的构造方法 构建方法时被调用 __destruct() 类的析构方法 明确销毁 ...