You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/12/10 12:49:11 UTC

[commons-compress] branch master updated: Javadoc and sort members

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d70f415 Javadoc and sort members
3d70f415 is described below

commit 3d70f4155cd7ff3eeb5c31ce8ddfc773b6bcb921
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Dec 10 07:49:06 2022 -0500

    Javadoc and sort members
---
 .../compress/archivers/sevenz/CoderBase.java       | 63 ++++++++++++++--------
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
index fa3c5f4a..ab05f6b3 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/CoderBase.java
@@ -24,11 +24,26 @@ import java.io.OutputStream;
 import org.apache.commons.compress.utils.ByteUtils;
 
 /**
- * Base Codec class.
+ * Abstracts a base Codec class.
  */
 abstract class CoderBase {
+
+    /**
+     * If the option represents a number, return its integer value, otherwise return the given default value.
+     *
+     * @param options      A Number.
+     * @param defaultValue A default value if options is not a number.
+     * @return The given number or default value.
+     */
+    protected static int numberOptionOrDefault(final Object options, final int defaultValue) {
+        return options instanceof Number ? ((Number) options).intValue() : defaultValue;
+    }
+
     private final Class<?>[] acceptableOptions;
+
     /**
+     * Constructs a new instance.
+     *
      * @param acceptableOptions types that can be used as options for this codec.
      */
     protected CoderBase(final Class<?>... acceptableOptions) {
@@ -36,6 +51,8 @@ abstract class CoderBase {
     }
 
     /**
+     * Tests whether this method can extract options from the given object.
+     *
      * @return whether this method can extract options from the given object.
      */
     boolean canAcceptOptions(final Object opts) {
@@ -48,38 +65,40 @@ abstract class CoderBase {
     }
 
     /**
-     * @return property-bytes to write in a Folder block
-     */
-    byte[] getOptionsAsProperties(final Object options) throws IOException {
-        return ByteUtils.EMPTY_BYTE_ARRAY;
-    }
-
-    /**
-     * @return configuration options that have been used to create the given InputStream from the given Coder
-     */
-    Object getOptionsFromCoder(final Coder coder, final InputStream in) throws IOException {
-        return null;
-    }
-
-    /**
+     * Decodes using stream that reads from in using the configured coder and password.
+     *
      * @return a stream that reads from in using the configured coder and password.
      */
-    abstract InputStream decode(final String archiveName,
-        final InputStream in, long uncompressedLength,
-        final Coder coder, byte[] password, int maxMemoryLimitInKb) throws IOException;
+    abstract InputStream decode(final String archiveName, final InputStream in, long uncompressedLength, final Coder coder, byte[] password,
+            int maxMemoryLimitInKb) throws IOException;
 
     /**
+     * Encodes using a stream that writes to out using the given configuration.
+     *
      * @return a stream that writes to out using the given configuration.
+     * @throws IOException Optionally thrown by subclassses.
      */
     OutputStream encode(final OutputStream out, final Object options) throws IOException {
         throw new UnsupportedOperationException("Method doesn't support writing");
     }
 
     /**
-     * If the option represents a number, return its integer
-     * value, otherwise return the given default value.
+     * Gets property bytes to write in a Folder block.
+     *
+     * @return property bytes to write in a Folder block.
+     * @throws IOException Optionally thrown by subclassses.
      */
-    protected static int numberOptionOrDefault(final Object options, final int defaultValue) {
-        return options instanceof Number ? ((Number) options).intValue() : defaultValue;
+    byte[] getOptionsAsProperties(final Object options) throws IOException {
+        return ByteUtils.EMPTY_BYTE_ARRAY;
+    }
+
+    /**
+     * Gets configuration options that have been used to create the given InputStream from the given Coder.
+     *
+     * @return configuration options that have been used to create the given InputStream from the given Coder
+     * @throws IOException Optionally thrown by subclassses.
+     */
+    Object getOptionsFromCoder(final Coder coder, final InputStream in) throws IOException {
+        return null;
     }
 }