aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/docx/ZippedDocxFile.java
blob: 6b8528a8543a14c944e5be5dcfff359ef18895de (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
package org.zwobble.mammoth.docx;

import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class ZippedDocxFile implements DocxFile {
    private final ZipFile zipFile;

    public ZippedDocxFile(ZipFile zipFile) {
        this.zipFile = zipFile;
    }

    @Override
    public InputStream getInputStream(String name) throws IOException {
        ZipEntry entry = zipFile.getEntry("word/document.xml");
        return zipFile.getInputStream(entry);
    }

    @Override
    public void close() throws IOException {
        zipFile.close();
    }
}