Attachments: How to get attachment metadata only?
There are few methods that allow you to download attachment metadata from a database:
- HeadAttachment
- GetAttachmentHeadersStartingWith
HeadAttachment
HeadAttachment can be used to download attachment metadata for a single attachment.
Syntax
@Deprecated
public Attachment headAttachment(String key);
Parameters | ||
---|---|---|
key | String | key of the attachment you want to download metadata for |
Return Value | |
---|---|
Attachment | Object that represents attachment. |
Example
Attachment attachment = store.getDatabaseCommands().headAttachment("albums/holidays/sea.jpg"); // null if does not exist
GetAttachmentHeadersStartingWith
GetAttachmentHeadersStartingWith can be used to download attachment metadata for a multiple attachments.
Syntax
@Deprecated
public List<Attachment> getAttachmentHeadersStartingWith(String idPrefix, int start, int pageSize);
Parameters | ||
---|---|---|
idPrefix | String | prefix for which attachments should be returned |
start | int | number of attachments that should be skipped |
pageSize | int | maximum number of attachments that will be returned |
Return Value | |
---|---|
List<AttachmentInformation> | Object that represents attachment metadata information. |
Example
List<Attachment> attachments = store.getDatabaseCommands().getAttachmentHeadersStartingWith("albums/holidays/", 0, 10);
Remarks
getData() in Attachment
will throw for the above methods.