View Source

h2. Via Document

{code:java}

Document doc = database.fetchDocument("docId");
Attachment a = doc.getAttachment("logo.png");

a.retrieve(new StreamContext() {
public void withInputStream(InputStream is) throws IOException {
// Use the InputStream
// InputStream will be closed automatically.
}
});

{code}