Search in sources :

Example 1 with InputStreamInputSource

use of org.xwiki.filter.input.InputStreamInputSource in project xwiki-platform by xwiki.

the class WikiReader method read.

public void read(Object filter, XARInputFilter proxyFilter) throws IOException, FilterException {
    InputStream stream;
    InputSource source = this.properties.getSource();
    if (source instanceof InputStreamInputSource) {
        stream = ((InputStreamInputSource) source).getInputStream();
    } else {
        throw new FilterException("Unsupported source type [" + source.getClass() + "]");
    }
    read(stream, filter, proxyFilter);
    // Close remaining opened spaces
    if (this.documentReader.getSentSpaceReference() != null) {
        for (EntityReference space = this.documentReader.getSentSpaceReference(); space != null; space = space.getParent()) {
            proxyFilter.endWikiSpace(space.getName(), FilterEventParameters.EMPTY);
        }
    }
    // Send extension event
    if (this.xarPackage.getPackageExtensionId() != null) {
        proxyFilter.beginExtension(this.xarPackage.getPackageExtensionId(), this.xarPackage.getPackageVersion(), FilterEventParameters.EMPTY);
        proxyFilter.endExtension(this.xarPackage.getPackageExtensionId(), this.xarPackage.getPackageVersion(), FilterEventParameters.EMPTY);
    }
}
Also used : InputStreamInputSource(org.xwiki.filter.input.InputStreamInputSource) InputSource(org.xwiki.filter.input.InputSource) ZipArchiveInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveInputStream) InputStream(java.io.InputStream) EntityReference(org.xwiki.model.reference.EntityReference) FilterException(org.xwiki.filter.FilterException) InputStreamInputSource(org.xwiki.filter.input.InputStreamInputSource)

Aggregations

InputStream (java.io.InputStream)1 ZipArchiveInputStream (org.apache.commons.compress.archivers.zip.ZipArchiveInputStream)1 FilterException (org.xwiki.filter.FilterException)1 InputSource (org.xwiki.filter.input.InputSource)1 InputStreamInputSource (org.xwiki.filter.input.InputStreamInputSource)1 EntityReference (org.xwiki.model.reference.EntityReference)1