IOS Basic class parsing-NSData

Source: Internet
Author: User

NSData Class Reference
Inherits from NSObject
Conforms to nscopying
nsmutablecopying
nssecurecoding
NSObject (nsobject)
framework /system/library/frameworks/foundation.framework
availability available in IOS 2.0 and later.
declared in nsdata.h
companion guides binary Data Programming Guide
property List Programming Guide
Related Sample Code advancedurlconnectionscryptoexerciseEademomvcnetworkingsimpleurlconnections
Overview

nsdata  and its mutable subclass nsmutabledata  provide Data Objects, object-oriented wrappers for byte buffers. Data Objects-let-allocated buffers (that's, data with no embedded pointers) take on the behavior of Foundation obj ECTs.

NSDataCreates static data objects, and NSMutableData creates dynamic Data objects. And is NSData NSMutableData typically used for data storage a ND is also useful in distributed Objects applications, where data contained on data Objects can be copied or moved Betwee n Applications.

The size of the data is subject to a theoretical limit of about 8 exabytes (in practice, the limit should isn't be a factor) .

NSDataIs ' toll-free bridged ' with its Core Foundation counterpart, CFDataRef . See "Toll-Free bridging" for more information on toll-free bridging.

Taskscreating 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
    • – isEqualToData:
    • – length
Storing Data
  • – writeToFile:atomically:
  • – writeToFile:options:error:
  • – writeToURL:atomically:
  • – writeToURL:options:error:


Copyright? Apple INC. All rights Reserved. Terms of Use | Privacy Policy | Updated:2014-02-11




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.