summaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/internal/documents/Image.java
blob: f112eedfeda03eef4365d9badd0927ff88917ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.zwobble.mammoth.internal.documents;

import org.zwobble.mammoth.internal.util.InputStreamSupplier;

import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;

public class Image implements DocumentElement {

    private final Optional<String> altText;
    private final Optional<String> contentType;
    private final InputStreamSupplier open;

    public Image(Optional<String> altText, Optional<String> contentType, InputStreamSupplier open) {
        this.altText = altText;
        this.contentType = contentType;
        this.open = open;
    }

    public Optional<String> getAltText() {
        return altText;
    }

    public Optional<String> getContentType() {
        return contentType;
    }

    public InputStream open() throws IOException {
        return open.open();
    }

    @Override
    public <T, U> T accept(DocumentElementVisitor<T, U> visitor, U context) {
        return visitor.visit(this, context);
    }
}