Package org.apache.tika.io

Examples of org.apache.tika.io.CloseShieldInputStream


        metadata.set(Metadata.CONTENT_TYPE, "application/x-tar");

        // At the end we want to close the tar stream to release any associated
        // resources, but the underlying document stream should not be closed
        TarArchiveInputStream tar =
            new TarArchiveInputStream(new CloseShieldInputStream(stream));
        try {
            parseArchive(tar, handler, metadata, context);
        } finally {
            tar.close();
        }
View Full Code Here


        metadata.set(Metadata.CONTENT_TYPE, "application/zip");

        // At the end we want to close the Zip stream to release any associated
        // resources, but the underlying document stream should not be closed
        ZipArchiveInputStream zip =
            new ZipArchiveInputStream(new CloseShieldInputStream(stream));
        try {
            parseArchive(zip, handler, metadata, context);
        } finally {
            zip.close();
        }
View Full Code Here

            Metadata metadata, ParseContext context)
            throws IOException, TikaException, SAXException {
        // At the end we want to close the cpio stream to release any associated
        // resources, but the underlying document stream should not be closed
        CpioArchiveInputStream cpio =
            new CpioArchiveInputStream(new CloseShieldInputStream(stream));
        try {
            parseArchive(cpio, handler, metadata, context);
        } finally {
            cpio.close();
        }
View Full Code Here

            Metadata metadata, ParseContext context)
            throws IOException, TikaException, SAXException {
        // At the end we want to close the ar stream to release any associated
        // resources, but the underlying document stream should not be closed
        ArArchiveInputStream ar =
            new ArArchiveInputStream(new CloseShieldInputStream(stream));
        try {
            parseArchive(ar, handler, metadata, context);
        } finally {
            ar.close();
        }
View Full Code Here

            factory.setValidating(false);
            factory.setNamespaceAware(true);
            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            SAXParser parser = factory.newSAXParser();
            parser.parse(
                    new CloseShieldInputStream(stream),
                    new OfflineContentHandler(
                            new NSNormalizerContentHandler(dh)));
        } catch (ParserConfigurationException e) {
            throw new TikaException("XML parser configuration error", e);
        }
View Full Code Here

            new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();
        xhtml.startElement("p");

        getSAXParser(context).parse(
                new CloseShieldInputStream(stream),
                new OfflineContentHandler(
                        getContentHandler(handler, metadata)));

        xhtml.endElement("p");
        xhtml.endDocument();
View Full Code Here

            stream = new BufferedInputStream(stream);
        }

        // Protect the stream from being closed by CyberNeko
        // TODO: Is this still needed, given our use of TagSoup?
        stream = new CloseShieldInputStream(stream);

        // Prepare the input source using the encoding hint if available
        InputSource source = new InputSource(stream);
        source.setEncoding(getEncoding(stream, metadata));
View Full Code Here

            if (!relevantFileNames.contains(entry.getName())) {
                entry = zip.getNextEntry();
                continue;
            }

            parser.parse(new CloseShieldInputStream(zip), handler, metadata, context);
            entry = zip.getNextEntry();
        }
        zip.close();
    }
View Full Code Here

          return;
        }

        xhtml.startDocument();
        context.getSAXParser().parse(
                new CloseShieldInputStream(stream),
                new OfflineContentHandler(contentHandler)
        );
        xhtml.endDocument();
    }
View Full Code Here

            new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();
        xhtml.startElement("p");

        context.getSAXParser().parse(
                new CloseShieldInputStream(stream),
                new OfflineContentHandler(
                        getContentHandler(handler, metadata)));

        xhtml.endElement("p");
        xhtml.endDocument();
View Full Code Here

TOP

Related Classes of org.apache.tika.io.CloseShieldInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.