You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/11/16 04:16:58 UTC
[jira] [Created] (COMPRESS-368) Allow compressor extensions through
a standard JRE ServiceLoader
Gary Gregory created COMPRESS-368:
-------------------------------------
Summary: Allow compressor extensions through a standard JRE ServiceLoader
Key: COMPRESS-368
URL: https://issues.apache.org/jira/browse/COMPRESS-368
Project: Commons Compress
Issue Type: New Feature
Components: Compressors
Reporter: Gary Gregory
Assignee: Gary Gregory
Allow compressor extensions through a standard JRE ServiceLoader.
Introduce a new interface {{org.apache.commons.compress.compressors.CompressorStreamProvider}}
Update {{CompressorStreamFactory}} to implement this new interface and use a service loader to pick up extra {{CompressorStreamProvider}}.
The service loader file is {{META-INF/services/org.apache.commons.compress.compressors.CompressorStreamProvider}}
The new interface:
{code:java}
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.commons.compress.compressors;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;
/**
* Creates Compressor {@link CompressorInputStream}s and
* {@link CompressorOutputStream}s.
*
* @since 1.13
*/
public interface CompressorStreamProvider {
/**
* Creates a compressor input stream from a compressor name and an input
* stream.
*
* @param name
* of the compressor, i.e. {@value #GZIP}, {@value #BZIP2},
* {@value #XZ}, {@value #LZMA}, {@value #PACK200},
* {@value #SNAPPY_RAW}, {@value #SNAPPY_FRAMED}, {@value #Z} or
* {@value #DEFLATE}
* @param in
* the input stream
* @return compressor input stream
* @throws CompressorException
* if the compressor name is not known
* @throws IllegalArgumentException
* if the name or input stream is null
*/
CompressorInputStream createCompressorInputStream(final String name, final InputStream in)
throws CompressorException;
/**
* Creates a compressor output stream from an compressor name and an output
* stream.
*
* @param name
* the compressor name, i.e. {@value #GZIP}, {@value #BZIP2},
* {@value #XZ}, {@value #PACK200} or {@value #DEFLATE}
* @param out
* the output stream
* @return the compressor output stream
* @throws CompressorException
* if the archiver name is not known
* @throws IllegalArgumentException
* if the archiver name or stream is null
*/
CompressorOutputStream createCompressorOutputStream(final String name, final OutputStream out)
throws CompressorException;
/**
* Gets all the input stream compressor names for this provider
*
* @return all the input compressor names for this provider
*/
Set<String> getInputStreamCompressorNames();
/**
* Gets all the output stream compressor names for this provider
*
* @return all the output compressor names for this provider
*/
Set<String> getOutputStreamCompressorNames();
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)