Couchbase Lite
Objective-C API for iOS and Mac OS
CBLAttachment.h
Go to the documentation of this file.
1 //
2 // CBLAttachment.h
3 // CouchbaseLite
4 //
5 // Created by Jens Alfke on 6/21/12.
6 // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved.
7 //
8 
9 #import "CBLBase.h"
11 
13 
18 @interface CBLAttachment : NSObject
19 
21 @property (readonly, retain) CBLRevision* revision;
22 
24 @property (readonly) CBLDocument* document;
25 
27 @property (readonly, copy) NSString* name;
28 
30 @property (readonly, nullable) NSString* contentType;
31 
33 @property (readonly) UInt64 length;
34 
37 @property (readonly) UInt64 encodedLength;
38 
40 @property (readonly) CBLJSONDict* metadata;
41 
46 @property (readonly) BOOL contentAvailable;
47 
49 @property (readonly, nullable) NSData* content;
50 
53 - (nullable NSInputStream*) openContentStream;
54 
62 @property (readonly, nullable) NSURL* contentURL;
63 
67 - (BOOL) purge;
68 
69 - (instancetype) init NS_UNAVAILABLE;
70 
71 @end
72 
73 
CBLDocument * document
The owning document.
Definition: CBLAttachment.h:24
NSString * contentType
The MIME type of the contents.
Definition: CBLAttachment.h:30
#define NS_ASSUME_NONNULL_BEGIN
Definition: CBLBase.h:20
A revision of a CBLDocument.
Definition: CBLRevision.h:17
NSData * content
The data of the attachment.
Definition: CBLAttachment.h:49
BOOL contentAvailable
Is the content locally available? This may be NO if the attachment's document was pulled from a remot...
Definition: CBLAttachment.h:46
#define nullable
Definition: CBLBase.h:22
A CouchbaseLite document (as opposed to any specific revision of it.)
Definition: CBLDocument.h:16
#define NS_ASSUME_NONNULL_END
Definition: CBLBase.h:21
CBLJSONDict * metadata
The Couchbase Lite metadata about the attachment, that lives in the document.
Definition: CBLAttachment.h:40
NSURL * contentURL
The (file:) URL of the file containing the contents.
Definition: CBLAttachment.h:62
An existing revision of a CBLDocument.
Definition: CBLRevision.h:80
nullable NSInputStream * openContentStream()
Returns a stream from which you can read the data of the attachment.
UInt64 length
The length in bytes of the contents.
Definition: CBLAttachment.h:33
NSString * name
The filename.
Definition: CBLAttachment.h:27
instancetype NS_UNAVAILABLE()
A binary attachment to a document revision.
Definition: CBLAttachment.h:18
UInt64 encodedLength
The length in bytes of the encoded form of the attachment.
Definition: CBLAttachment.h:37
CBLRevision * revision
The owning document revision.
Definition: CBLAttachment.h:21
BOOL purge()
Deletes the attachment's contents from local storage.