Example usage for org.apache.commons.compress.archivers ArchiveStreamProvider getInputStreamArchiveNames

List of usage examples for org.apache.commons.compress.archivers ArchiveStreamProvider getInputStreamArchiveNames

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers ArchiveStreamProvider getInputStreamArchiveNames.

Prototype

Set<String> getInputStreamArchiveNames();

Source Link

Document

Gets all the input stream archive names for this provider

Usage

From source file:org.apache.tika.parser.pkg.TikaArchiveStreamFactory.java

/**
 * Constructs a new sorted map from input stream provider names to provider
 * objects.//from w  w w.  j  av  a 2  s. c o m
 *
 * <p>
 * The map returned by this method will have one entry for each provider for
 * which support is available in the current Java virtual machine. If two or
 * more supported provider have the same name then the resulting map will
 * contain just one of them; which one it will contain is not specified.
 * </p>
 *
 * <p>
 * The invocation of this method, and the subsequent use of the resulting
 * map, may cause time-consuming disk or network I/O operations to occur.
 * This method is provided for applications that need to enumerate all of
 * the available providers, for example to allow user provider selection.
 * </p>
 *
 * <p>
 * This method may return different results at different times if new
 * providers are dynamically made available to the current Java virtual
 * machine.
 * </p>
 *
 * @return An immutable, map from names to provider objects
 * @since 1.13
 */
public static SortedMap<String, ArchiveStreamProvider> findAvailableArchiveInputStreamProviders() {
    return AccessController.doPrivileged(new PrivilegedAction<SortedMap<String, ArchiveStreamProvider>>() {
        @Override
        public SortedMap<String, ArchiveStreamProvider> run() {
            TreeMap<String, ArchiveStreamProvider> map = new TreeMap<>();
            putAll(SINGLETON.getInputStreamArchiveNames(), SINGLETON, map);
            for (ArchiveStreamProvider provider : findArchiveStreamProviders()) {
                putAll(provider.getInputStreamArchiveNames(), provider, map);
            }
            return map;
        }
    });
}