Package org.apache.commons.io.input

Examples of org.apache.commons.io.input.CloseShieldInputStream


        xhtml.startDocument();

        // At the end we want to close the tar stream to release any associated
        // resources, but the underlying document stream should not be closed
        TarInputStream tar =
            new TarInputStream(new CloseShieldInputStream(stream));
        try {
            TarEntry entry = tar.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    Metadata entrydata = new Metadata();
View Full Code Here


    public void parse(
            InputStream stream, ContentHandler handler, Metadata metadata)
            throws IOException, SAXException, TikaException {
        // Protect the stream from being closed by CyberNeko
        stream = new CloseShieldInputStream(stream);

        // Prepare the HTML content handler that generates proper
        // XHTML events to records relevant document metadata
        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        XPathParser xpath = new XPathParser(null, "");
View Full Code Here

        xhtml.startDocument();

        // At the end we want to close the Zip stream to release any associated
        // resources, but the underlying document stream should not be closed
        ZipInputStream zip =
            new ZipInputStream(new CloseShieldInputStream(stream));
        try {
            ZipEntry entry = zip.getNextEntry();
            while (entry != null) {
                Metadata entrydata = new Metadata();
                entrydata.set(Metadata.RESOURCE_NAME_KEY, entry.getName());
View Full Code Here

  private CountingInputStream countingIn;
  private long maxBytes;

  public FixedLengthInputStream(InputStream stream, long maxLen) {
    super(new CountingInputStream(new CloseShieldInputStream(stream)));

    // Save a correctly-typed reference to the underlying stream.
    this.countingIn = (CountingInputStream) this.in;
    this.maxBytes = maxLen;
  }
View Full Code Here

        this.stream = new MarkDetectingInputStream(in);
        this.size = size;
    }
   
    public InputStream getStream() {
        return new CloseShieldInputStream(stream);
    }
View Full Code Here

                }
                String path = zipFile.getPath() + ":" + name;
                name = name.substring((Constants.META_DIR + "/").length());
                if (name.equals(Constants.FILTER_XML)) {
                    // load filter
                    inf.loadFilter(new CloseShieldInputStream(zin), path);
                } else if (name.equals(Constants.CONFIG_XML)) {
                    // load config
                    inf.loadConfig(new CloseShieldInputStream(zin), path);
                } else if (name.equals(Constants.SETTINGS_XML)) {
                    // load settings
                    inf.loadSettings(new CloseShieldInputStream(zin), path);
                } else if (name.equals(Constants.PROPERTIES_XML)) {
                    // load properties
                    inf.loadProperties(new CloseShieldInputStream(zin), path);
                } else if (name.equals(Constants.PRIVILEGES_XML)) {
                    // load privileges
                    inf.loadPrivileges(new CloseShieldInputStream(zin), path);
                } else if (name.equals(Constants.PACKAGE_DEFINITION_XML)) {
                    inf.setHasDefinition(true);
                    log.debug("Contains package definition {}.", path);
                } else if (name.endsWith(".cnd")) {
                    try {
                        Reader r = new InputStreamReader(new CloseShieldInputStream(zin), "utf8");
                        CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                        reader.read(r, entry.getName(), null);
                        inf.getNodeTypes().add(reader);
                        log.debug("Loaded nodetypes from {}.", path);
                    } catch (IOException e1) {
View Full Code Here

TOP

Related Classes of org.apache.commons.io.input.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.