Repository: commons-compress Updated Branches: refs/heads/master b4445543d -> 3e3a13883
Rename HasCharset to CharsetAccessor (until someone comes up with a better name before 1.15.) Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/3e3a1388 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/3e3a1388 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/3e3a1388 Branch: refs/heads/master Commit: 3e3a1388368e8e4421fed0b5222904d40a8805ce Parents: b444554 Author: Gary Gregory <[email protected]> Authored: Mon Jul 10 15:02:32 2017 -0700 Committer: Gary Gregory <[email protected]> Committed: Mon Jul 10 15:02:32 2017 -0700 ---------------------------------------------------------------------- .../compress/archivers/zip/CharsetAccessor.java | 44 ++++++++++++++++++++ .../compress/archivers/zip/HasCharset.java | 44 -------------------- .../compress/archivers/zip/NioZipEncoding.java | 2 +- .../compress/archivers/zip/ZipEncodingTest.java | 4 +- 4 files changed, 47 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3e3a1388/src/main/java/org/apache/commons/compress/archivers/zip/CharsetAccessor.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/CharsetAccessor.java b/src/main/java/org/apache/commons/compress/archivers/zip/CharsetAccessor.java new file mode 100644 index 0000000..e5342be --- /dev/null +++ b/src/main/java/org/apache/commons/compress/archivers/zip/CharsetAccessor.java @@ -0,0 +1,44 @@ +/* + * 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.archivers.zip; + +import java.nio.charset.Charset; + +/** + * An interface added to allow access to the character set associated with an {@link NioZipEncoding}, + * without requiring a new method to be added to {@link ZipEncoding}. + * <p> + * This avoids introducing a + * potentially breaking change, or making {@link NioZipEncoding} a public class. + * </p> + * @since 1.15 + */ +public interface CharsetAccessor { + + /** + * Provides access to the character set associated with an object. + * <p> + * This allows nio oriented code to use more natural character encoding/decoding methods, + * whilst allowing existing code to continue to rely on special-case error handling for UTF-8. + * </p> + * @return the character set associated with this object + */ + Charset getCharset(); +} http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3e3a1388/src/main/java/org/apache/commons/compress/archivers/zip/HasCharset.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/HasCharset.java b/src/main/java/org/apache/commons/compress/archivers/zip/HasCharset.java deleted file mode 100644 index b370a01..0000000 --- a/src/main/java/org/apache/commons/compress/archivers/zip/HasCharset.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.archivers.zip; - -import java.nio.charset.Charset; - -/** - * An interface added to allow access to the character set associated with an {@link NioZipEncoding}, - * without requiring a new method to be added to {@link ZipEncoding}. - * <p> - * This avoids introducing a - * potentially breaking change, or making {@link NioZipEncoding} a public class. - * </p> - * @since 1.15 - */ -public interface HasCharset { - - /** - * Provides access to the character set associated with an object. - * <p> - * This allows nio oriented code to use more natural character encoding/decoding methods, - * whilst allowing existing code to continue to rely on special-case error handling for UTF-8. - * </p> - * @return the character set associated with this object - */ - Charset getCharset(); -} http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3e3a1388/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java index 98d26d9..0a7581a 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/NioZipEncoding.java @@ -34,7 +34,7 @@ import java.nio.charset.CodingErrorAction; * <p>The methods of this class are reentrant.</p> * @Immutable */ -class NioZipEncoding implements ZipEncoding, HasCharset { +class NioZipEncoding implements ZipEncoding, CharsetAccessor { private final Charset charset; private final boolean useReplacement; http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3e3a1388/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java index 15273c7..1f798d0 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEncodingTest.java @@ -56,8 +56,8 @@ public class ZipEncodingTest { public void testGetNonexistentEncodng() throws IOException { ZipEncoding ze = ZipEncodingHelper.getZipEncoding("I-am-a-banana"); assertNotNull(ze); - if (ze instanceof HasCharset) { - HasCharset hasCharset = (HasCharset) ze; + if (ze instanceof CharsetAccessor) { + CharsetAccessor hasCharset = (CharsetAccessor) ze; Assert.assertEquals(Charset.defaultCharset(), hasCharset.getCharset()); } }
