Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Commons Compress into multiple artifacts #490

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*.zst binary
.gitattributes text
# These must be identical to the copies in SHRUNK.ZIP
src/test/resources/test1.xml eol=lf
src/test/resources/test2.xml eol=lf
src/test/resources/test3.xml eol=lf
src/test/resources/test4.xml eol=lf
src/test/resources/test?with?spaces.txt eol=lf
src/test/resources/test.txt eol=lf
src/test/resources/COMPRESS-380-input binary
compress-core/src/test/resources/test1.xml eol=lf
compress-core/src/test/resources/test2.xml eol=lf
compress-core/src/test/resources/test3.xml eol=lf
compress-core/src/test/resources/test4.xml eol=lf
compress-core/src/test/resources/test?with?spaces.txt eol=lf
compress-core/src/test/resources/test.txt eol=lf
compress-core/src/test/resources/COMPRESS-380-input binary
73 changes: 73 additions & 0 deletions compress-brotli/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress-parent</artifactId>
<version>1.26.1-SNAPSHOT</version>
<relativePath>../compress-parent</relativePath>
</parent>

<groupId>org.apache.commons</groupId>
<artifactId>commons-compress-brotli</artifactId>
<name>Apache Commons Compress: Brotli</name>
<!-- The description is not indented to make it look better in the release notes -->
<description>Brotli compression support for Apache Commons Compress.</description>

<properties>
<japicmp.skip>true</japicmp.skip>
<!-- JPMS module name -->
<commons.module.name>org.apache.commons.compress.brotli</commons.module.name>
</properties>

<dependencies>

<dependency>
<groupId>org.brotli</groupId>
<artifactId>dec</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress-core</artifactId>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>

<!-- Scope: test -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.brotli.internal;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.Set;

import org.apache.commons.compress.compressors.CompressorException;
import org.apache.commons.compress.compressors.CompressorInputStream;
import org.apache.commons.compress.compressors.CompressorOutputStream;
import org.apache.commons.compress.compressors.CompressorStreamProvider;
import org.apache.commons.compress.compressors.brotli.BrotliCompressorInputStream;

public class BrotliCompressorStreamProvider implements CompressorStreamProvider {

private static final String BROTLI = "br";
private static final CompressorStreamProvider INSTANCE = new BrotliCompressorStreamProvider();

// Used by Java 9 ServiceLoader
public static CompressorStreamProvider provider() {
return INSTANCE;
}

@Override
public CompressorInputStream createCompressorInputStream(final String name,
final InputStream in,
final boolean decompressUntilEOF) throws CompressorException {
if (BROTLI.equals(name)) {
try {
return new BrotliCompressorInputStream(in);
} catch (final IOException e) {
throw new CompressorException("Could not create CompressorInputStream.", e);
}
}
throw new CompressorException("Compressor: " + name + " not found.");
}

@Override
public CompressorOutputStream createCompressorOutputStream(String name, OutputStream out) throws CompressorException {
throw new CompressorException("Compressor: " + name + " not found.");
}

@Override
public Set<String> getInputStreamCompressorNames() {
return Collections.singleton(BROTLI);
}

@Override
public Set<String> getOutputStreamCompressorNames() {
return Collections.emptySet();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*/
/**
* Internal package containing the {@link java.util.ServiceLoader} provider.
*/
package org.apache.commons.compress.compressors.brotli.internal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# 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.
#
org.apache.commons.compress.compressors.brotli.internal.BrotliCompressorStreamProvider
Loading