![]() |
Couchbase Lite
Objective-C API for iOS and Mac OS
|
A CBLBlob appears as a property of a CBLDocument; it contains arbitrary binary data, tagged with a MIME type.
Blobs can be arbitrarily large, and their data is loaded only on demand (when the content
or contentStream
properties are accessed), not when the document is loaded.
The document's raw JSON form only contains the CBLBlob's metadata (type, length and a digest of the data) in a small object. The data itself is stored externally to the document, keyed by the digest.
Instance Methods | |
(nullable instancetype) | - initWithContentType:data:error: |
Initializes a CBLBlob with the given in-memory data. More... | |
(nullable instancetype) | - initWithContentType:contentStream:error: |
Initializes a CBLBlob with the given stream of data. More... | |
(nullable instancetype) | - initWithContentType:fileURL:error: |
Initializes a CBLBlob with the contents of a file. More... | |
(instancetype) | - NS_UNAVAILABLE |
Properties | |
NSData * | content |
Gets the contents of a CBLBlob as a block of memory. More... | |
NSInputStream * | contentStream |
A stream of the content of a CBLBlob. More... | |
NSString * | contentType |
The type of content this CBLBlob represents; by convention this is a MIME type. More... | |
uint64_t | length |
The binary length of this CBLBlob. More... | |
NSString * | digest |
The cryptographic digest of this CBLBlob's contents, which uniquely identifies it. More... | |
NSDictionary * | properties |
The metadata associated with this CBLBlob. More... | |
- (nullable instancetype) initWithContentType: | (NSString *) | contentType | |
data: | (NSData *) | data | |
error: | (NSError **) | error | |
Initializes a CBLBlob with the given in-memory data.
The blob can then be added as a property of a CBLDocument.
- (nullable instancetype) initWithContentType: | (NSString *) | contentType | |
contentStream: | (NSInputStream *) | stream | |
error: | (NSError **) | error | |
Initializes a CBLBlob with the given stream of data.
The blob can then be added as a property of a CBLDocument.
- (nullable instancetype) initWithContentType: | (NSString *) | contentType | |
fileURL: | (NSURL *) | fileURL | |
error: | (NSError **) | error | |
Initializes a CBLBlob with the contents of a file.
The blob can then be added as a property of a CBLDocument.
- (instancetype) NS_UNAVAILABLE |
|
readnonatomicassign |
Gets the contents of a CBLBlob as a block of memory.
Not recommended for very large blobs, as it may be slow and use up lots of RAM.
|
readnonatomicassign |
A stream of the content of a CBLBlob.
The caller is responsible for opening the stream, and closing it when finished.
|
readnonatomicassign |
The type of content this CBLBlob represents; by convention this is a MIME type.
|
readnonatomicassign |
The binary length of this CBLBlob.
|
readnonatomicassign |
The cryptographic digest of this CBLBlob's contents, which uniquely identifies it.
|
readnonatomicassign |
The metadata associated with this CBLBlob.