Attachments: Put
PutAttachment is used to insert or update an attachment in a database.
Syntax
@Deprecated
public void putAttachment(String key, Etag etag, InputStream data, RavenJObject metadata);
Parameters | ||
---|---|---|
key | String | unique key under which attachment will be stored |
etag | Etag | current attachment etag, used for concurrency checks (null to skip check) |
data | InputStream | attachment data |
metadata | RavenJObject | attachment metadata |
Example
try (FileInputStream fis = new FileInputStream("sea.png")) {
RavenJObject metadata = new RavenJObject();
metadata.add("Description", "Holidays 2014");
store
.getDatabaseCommands()
.putAttachment("albums/holidays/sea.jpg", null, fis, metadata);
}