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

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

Introduction

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

Prototype

Set<String> getOutputStreamArchiveNames();

Source Link

Document

Gets all the output stream archive names for this provider

Usage

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

/**
 * Constructs a new sorted map from output stream provider names to provider
 * objects.//  w w w . j a va  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> findAvailableArchiveOutputStreamProviders() {
    return AccessController.doPrivileged(new PrivilegedAction<SortedMap<String, ArchiveStreamProvider>>() {
        @Override
        public SortedMap<String, ArchiveStreamProvider> run() {
            TreeMap<String, ArchiveStreamProvider> map = new TreeMap<>();
            putAll(SINGLETON.getOutputStreamArchiveNames(), SINGLETON, map);
            for (ArchiveStreamProvider provider : findArchiveStreamProviders()) {
                putAll(provider.getOutputStreamArchiveNames(), provider, map);
            }
            return map;
        }
    });
}