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

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

commit a1b7b8c1253d5e82856a7c24fb5f93932d866f8c
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jul 31 12:10:53 2026 -0400

    Fold LH subclasses into super class.
    
    Reduce public API footprint.
---
 .../archivers/lha/LhaArchiveInputStream.java       | 13 ++--
 .../compressors/lha/Lh4CompressorInputStream.java  | 44 ------------
 .../compressors/lha/Lh5CompressorInputStream.java  | 44 ------------
 .../compressors/lha/Lh6CompressorInputStream.java  | 44 ------------
 .../compressors/lha/Lh7CompressorInputStream.java  | 44 ------------
 ...a => LhStaticHuffmanCompressorInputStream.java} | 64 +++++++++++++++--
 .../lha/Lh4CompressorInputStreamTest.java          |  6 +-
 .../lha/Lh5CompressorInputStreamTest.java          |  8 ++-
 .../lha/Lh6CompressorInputStreamTest.java          |  6 +-
 .../lha/Lh7CompressorInputStreamTest.java          |  9 ++-
 ... LhStaticHuffmanCompressorInputStreamTest.java} | 81 ++++++++++------------
 11 files changed, 120 insertions(+), 243 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/lha/LhaArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/lha/LhaArchiveInputStream.java
index c7570550d..de7f4da24 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/lha/LhaArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/lha/LhaArchiveInputStream.java
@@ -38,10 +38,7 @@
 import org.apache.commons.compress.archivers.ArchiveException;
 import org.apache.commons.compress.archivers.ArchiveInputStream;
 import org.apache.commons.compress.archivers.zip.ZipUtil;
-import org.apache.commons.compress.compressors.lha.Lh4CompressorInputStream;
-import org.apache.commons.compress.compressors.lha.Lh5CompressorInputStream;
-import org.apache.commons.compress.compressors.lha.Lh6CompressorInputStream;
-import org.apache.commons.compress.compressors.lha.Lh7CompressorInputStream;
+import 
org.apache.commons.compress.compressors.lha.LhStaticHuffmanCompressorInputStream;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.input.BoundedInputStream;
 import org.apache.commons.io.input.ChecksumInputStream;
@@ -509,16 +506,16 @@ private LhaArchiveEntry prepareDecompression(final 
LhaArchiveEntry entry) throws
                     .setInputStream(this.currentCompressedStream).get();
         } else if 
(COMPRESSION_METHOD_LH4.equals(entry.getCompressionMethod())) {
             this.currentDecompressedStream = 
ChecksumInputStream.builder().setChecksum(Crc16.arc()).setExpectedChecksumValue(entry.getCrcValue())
-                    .setInputStream(new 
Lh4CompressorInputStream(this.currentCompressedStream)).get();
+                    
.setInputStream(LhStaticHuffmanCompressorInputStream.lh4CompressorInputStream(this.currentCompressedStream)).get();
         } else if 
(COMPRESSION_METHOD_LH5.equals(entry.getCompressionMethod())) {
             this.currentDecompressedStream = 
ChecksumInputStream.builder().setChecksum(Crc16.arc()).setExpectedChecksumValue(entry.getCrcValue())
-                    .setInputStream(new 
Lh5CompressorInputStream(this.currentCompressedStream)).get();
+                    
.setInputStream(LhStaticHuffmanCompressorInputStream.lh5CompressorInputStream(this.currentCompressedStream)).get();
         } else if 
(COMPRESSION_METHOD_LH6.equals(entry.getCompressionMethod())) {
             this.currentDecompressedStream = 
ChecksumInputStream.builder().setChecksum(Crc16.arc()).setExpectedChecksumValue(entry.getCrcValue())
-                    .setInputStream(new 
Lh6CompressorInputStream(this.currentCompressedStream)).get();
+                    
.setInputStream(LhStaticHuffmanCompressorInputStream.lh6CompressorInputStream(this.currentCompressedStream)).get();
         } else if 
(COMPRESSION_METHOD_LH7.equals(entry.getCompressionMethod())) {
             this.currentDecompressedStream = 
ChecksumInputStream.builder().setChecksum(Crc16.arc()).setExpectedChecksumValue(entry.getCrcValue())
-                    .setInputStream(new 
Lh7CompressorInputStream(this.currentCompressedStream)).get();
+                    
.setInputStream(LhStaticHuffmanCompressorInputStream.lh7CompressorInputStream(this.currentCompressedStream)).get();
         } else {
             // Unsupported compression
             this.currentDecompressedStream = null;
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStream.java
deleted file mode 100644
index e2b0c1b36..000000000
--- 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStream.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
- *
- *   https://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.lha;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Decompressor for lh4. It has a dictionary size of 4096 bytes.
- *
- * @since 1.29.0
- */
-public class Lh4CompressorInputStream extends 
AbstractLhStaticHuffmanCompressorInputStream {
-
-    private static final int DICT_BITS_LH4 = 12;
-
-    /**
-     * Constructs a new Lh4CompressorInputStream which decompresses bytes read 
from the specified stream.
-     *
-     * @param in the InputStream from which to read compressed data.
-     * @throws IOException if an I/O error occurs
-     */
-    public Lh4CompressorInputStream(final InputStream in) throws IOException {
-        super(in, DICT_BITS_LH4, 4, DICT_BITS_LH4 + 2);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStream.java
deleted file mode 100644
index bb5f418e8..000000000
--- 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStream.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
- *
- *   https://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.lha;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Decompressor for lh5. It has a dictionary size of 8192 bytes.
- *
- * @since 1.29.0
- */
-public class Lh5CompressorInputStream extends 
AbstractLhStaticHuffmanCompressorInputStream {
-
-    private static final int DICT_BITS_LH5 = 13;
-
-    /**
-     * Constructs a new Lh5CompressorInputStream which decompresses bytes read 
from the specified stream.
-     *
-     * @param in the InputStream from which to read compressed data.
-     * @throws IOException if an I/O error occurs.
-     */
-    public Lh5CompressorInputStream(final InputStream in) throws IOException {
-        super(in, DICT_BITS_LH5, 4, DICT_BITS_LH5 + 1);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStream.java
deleted file mode 100644
index c14eb54ad..000000000
--- 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStream.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
- *
- *   https://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.lha;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Decompressor for lh6. It has a dictionary size of 32768 bytes.
- *
- * @since 1.29.0
- */
-public class Lh6CompressorInputStream extends 
AbstractLhStaticHuffmanCompressorInputStream {
-
-    private static final int DICT_BITS_LH6 = 15;
-
-    /**
-     * Constructs a new Lh6CompressorInputStream which decompresses bytes read 
from the specified stream.
-     *
-     * @param in the InputStream from which to read compressed data.
-     * @throws IOException if an I/O error occurs.
-     */
-    public Lh6CompressorInputStream(final InputStream in) throws IOException {
-        super(in, DICT_BITS_LH6, 5, DICT_BITS_LH6 + 1);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStream.java
deleted file mode 100644
index bfc8e0d86..000000000
--- 
a/src/main/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStream.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
- *
- *   https://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.lha;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Decompressor for lh7. It has a dictionary size of 65536 bytes.
- *
- * @since 1.29.0
- */
-public class Lh7CompressorInputStream extends 
AbstractLhStaticHuffmanCompressorInputStream {
-
-    private static final int DICT_BITS_LH7 = 16;
-
-    /**
-     * Constructs a new Lh7CompressorInputStream which decompresses bytes read 
from the specified stream.
-     *
-     * @param in the InputStream from which to read compressed data.
-     * @throws IOException if an I/O error occurs.
-     */
-    public Lh7CompressorInputStream(final InputStream in) throws IOException {
-        super(in, DICT_BITS_LH7, 5, DICT_BITS_LH7 + 1);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStream.java
 
b/src/main/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStream.java
similarity index 83%
rename from 
src/main/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStream.java
rename to 
src/main/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStream.java
index daf615396..00aeb375b 100644
--- 
a/src/main/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStream.java
@@ -31,8 +31,10 @@
 
 /**
  * Implements a static Huffman compressor input stream for LHA files that 
supports lh4, lh5, lh6 and lh7 compression methods.
+ *
+ * @since 1.29.0
  */
-abstract class AbstractLhStaticHuffmanCompressorInputStream extends 
CompressorInputStream implements InputStreamStatistics {
+public class LhStaticHuffmanCompressorInputStream extends 
CompressorInputStream implements InputStreamStatistics {
 
     /**
      * Number of bits used to encode the command decoding tree length.
@@ -61,6 +63,14 @@ abstract class AbstractLhStaticHuffmanCompressorInputStream 
extends CompressorIn
 
     private static final int MAX_CODE_LENGTH = 16;
 
+    private static final int DICT_BITS_LH4 = 12;
+
+    private static final int DICT_BITS_LH5 = 13;
+
+    private static final int DICT_BITS_LH6 = 15;
+
+    private static final int DICT_BITS_LH7 = 16;
+
     private BitInputStream bin;
 
     private CircularBuffer buffer;
@@ -83,16 +93,60 @@ abstract class AbstractLhStaticHuffmanCompressorInputStream 
extends CompressorIn
 
     private final int maxNumberOfDistanceCodes;
 
+    /**
+     * Creates a new LhStaticHuffmanCompressorInputStream for the specified 
InputStream and LH4.
+     *
+     * @param in The InputStream to read compressed data from.
+     * @return a new LhStaticHuffmanCompressorInputStream for LH4.
+     * @throws IOException Thrown if an I/O error occurs.
+     */
+    public static LhStaticHuffmanCompressorInputStream 
lh4CompressorInputStream(final InputStream in) throws IOException {
+        return new LhStaticHuffmanCompressorInputStream(in, DICT_BITS_LH4, 4, 
DICT_BITS_LH4 + 2);
+    }
+
+    /**
+     * Creates a new LhStaticHuffmanCompressorInputStream for the specified 
InputStream and LH5.
+     *
+     * @param in The InputStream to read compressed data from.
+     * @return a new LhStaticHuffmanCompressorInputStream for LH5.
+     * @throws IOException Thrown if an I/O error occurs.
+     */
+    public static LhStaticHuffmanCompressorInputStream 
lh5CompressorInputStream(final InputStream in) throws IOException {
+        return new LhStaticHuffmanCompressorInputStream(in, DICT_BITS_LH5, 4, 
DICT_BITS_LH5 + 1);
+    }
+
+    /**
+     * Creates a new LhStaticHuffmanCompressorInputStream for the specified 
InputStream and LH6.
+     *
+     * @param in The InputStream to read compressed data from.
+     * @return a new LhStaticHuffmanCompressorInputStream for LH6.
+     * @throws IOException Thrown if an I/O error occurs.
+     */
+    public static LhStaticHuffmanCompressorInputStream 
lh6CompressorInputStream(final InputStream in) throws IOException {
+        return new LhStaticHuffmanCompressorInputStream(in, DICT_BITS_LH6, 5, 
DICT_BITS_LH6 + 1);
+    }
+
+    /**
+     * Creates a new LhStaticHuffmanCompressorInputStream for the specified 
InputStream and LH7.
+     *
+     * @param in The InputStream to read compressed data from.
+     * @return a new LhStaticHuffmanCompressorInputStream for LH7.
+     * @throws IOException Thrown if an I/O error occurs.
+     */
+    public static LhStaticHuffmanCompressorInputStream 
lh7CompressorInputStream(final InputStream in) throws IOException {
+        return new LhStaticHuffmanCompressorInputStream(in, DICT_BITS_LH7, 5, 
DICT_BITS_LH7 + 1);
+    }
+
     /**
      * Constructs a new CompressorInputStream which decompresses bytes read 
from the specified stream.
      *
-     * @param in The InputStream from which to read compressed data.
-     * @param dictionaryBits The number of bits used for the dictionary size.
-     * @param distanceBits The number of bits used for the distance.
+     * @param in                       The InputStream from which to read 
compressed data.
+     * @param dictionaryBits           The number of bits used for the 
dictionary size.
+     * @param distanceBits             The number of bits used for the 
distance.
      * @param maxNumberOfDistanceCodes The maximum number of distance codes.
      * @throws IOException if an I/O error occurs.
      */
-    AbstractLhStaticHuffmanCompressorInputStream(final InputStream in, final 
int dictionaryBits, final int distanceBits, final int maxNumberOfDistanceCodes)
+    LhStaticHuffmanCompressorInputStream(final InputStream in, final int 
dictionaryBits, final int distanceBits, final int maxNumberOfDistanceCodes)
             throws IOException {
         this.dictionaryBits = dictionaryBits;
         this.distanceBits = distanceBits;
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStreamTest.java
index 633b33d6c..6c93da3a5 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStreamTest.java
@@ -33,10 +33,14 @@
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 
+/**
+ * Tests {@link LhStaticHuffmanCompressorInputStream} for LH4.
+ */
 class Lh4CompressorInputStreamTest extends AbstractTest {
     @Test
     void testConfiguration() throws IOException {
-        try (Lh4CompressorInputStream in = new Lh4CompressorInputStream(new 
ByteArrayInputStream(new byte[0]))) {
+        try (LhStaticHuffmanCompressorInputStream in = 
LhStaticHuffmanCompressorInputStream
+                .lh4CompressorInputStream(new ByteArrayInputStream(new 
byte[0]))) {
             assertEquals(12, in.getDictionaryBits());
             assertEquals(4096, in.getDictionarySize());
             assertEquals(4, in.getDistanceBits());
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStreamTest.java
index 52d314ffe..77530db3c 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStreamTest.java
@@ -33,10 +33,14 @@
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 
+/**
+ * Tests {@link LhStaticHuffmanCompressorInputStream} for LH5.
+ */
 class Lh5CompressorInputStreamTest extends AbstractTest {
+
     @Test
     void testConfiguration() throws IOException {
-        try (Lh5CompressorInputStream in = new Lh5CompressorInputStream(new 
ByteArrayInputStream(new byte[0]))) {
+        try (LhStaticHuffmanCompressorInputStream in = 
LhStaticHuffmanCompressorInputStream.lh5CompressorInputStream(new 
ByteArrayInputStream(new byte[0]))) {
             assertEquals(8192, in.getDictionarySize());
             assertEquals(13, in.getDictionaryBits());
             assertEquals(4, in.getDistanceBits());
@@ -57,11 +61,9 @@ void testDecompress() throws IOException {
             assertEquals(39999, entry.getCompressedSize());
             assertEquals("-lh5-", entry.getCompressionMethod());
             assertEquals(0x8c8a, entry.getCrcValue());
-
             // Decompress entry
             assertTrue(archive.canReadEntryData(entry));
             final byte[] data = IOUtils.toByteArray(archive);
-
             assertEquals(144060, data.length);
             assertEquals("\nLorem ipsum", new String(data, 0, 12, 
StandardCharsets.US_ASCII));
         }
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStreamTest.java
index a9645f705..b68f8b449 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStreamTest.java
@@ -33,10 +33,14 @@
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 
+/**
+ * Tests {@link LhStaticHuffmanCompressorInputStream} for LH6.
+ */
 class Lh6CompressorInputStreamTest extends AbstractTest {
     @Test
     void testConfiguration() throws IOException {
-        try (Lh6CompressorInputStream in = new Lh6CompressorInputStream(new 
ByteArrayInputStream(new byte[0]))) {
+        try (LhStaticHuffmanCompressorInputStream in = 
LhStaticHuffmanCompressorInputStream
+                .lh6CompressorInputStream(new ByteArrayInputStream(new 
byte[0]))) {
             assertEquals(15, in.getDictionaryBits());
             assertEquals(32768, in.getDictionarySize());
             assertEquals(5, in.getDistanceBits());
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStreamTest.java
index 47e767ba8..5f8e10bd6 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStreamTest.java
@@ -33,10 +33,15 @@
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 
+/**
+ * Tests {@link LhStaticHuffmanCompressorInputStream} for LH7.
+ */
 class Lh7CompressorInputStreamTest extends AbstractTest {
+
     @Test
     void testConfiguration() throws IOException {
-        try (Lh7CompressorInputStream in = new Lh7CompressorInputStream(new 
ByteArrayInputStream(new byte[0]))) {
+        try (LhStaticHuffmanCompressorInputStream in = 
LhStaticHuffmanCompressorInputStream
+                .lh7CompressorInputStream(new ByteArrayInputStream(new 
byte[0]))) {
             assertEquals(16, in.getDictionaryBits());
             assertEquals(65536, in.getDictionarySize());
             assertEquals(5, in.getDistanceBits());
@@ -57,11 +62,9 @@ void testDecompress() throws IOException {
             assertEquals(37401, entry.getCompressedSize());
             assertEquals("-lh7-", entry.getCompressionMethod());
             assertEquals(0x8c8a, entry.getCrcValue());
-
             // Decompress entry
             assertTrue(archive.canReadEntryData(entry));
             final byte[] data = IOUtils.toByteArray(archive);
-
             assertEquals(144060, data.length);
             assertEquals("\nLorem ipsum", new String(data, 0, 12, 
StandardCharsets.US_ASCII));
         }
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStreamTest.java
similarity index 70%
rename from 
src/test/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStreamTest.java
rename to 
src/test/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStreamTest.java
index 342da17c4..7de34cddd 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/lha/LhStaticHuffmanCompressorInputStreamTest.java
@@ -31,31 +31,28 @@
 import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 
-class AbstractLhStaticHuffmanCompressorInputStreamTest {
-    private Lh5CompressorInputStream createLh5CompressorInputStream(final 
int... data) throws IOException {
+/*
+ * Tests {@link LhStaticHuffmanCompressorInputStream}.
+ */
+class LhStaticHuffmanCompressorInputStreamTest {
+
+    private LhStaticHuffmanCompressorInputStream 
createLh5CompressorInputStream(final int... data) throws IOException {
         final byte[] bytes = new byte[data.length];
         for (int i = 0; i < data.length; i++) {
             bytes[i] = (byte) data[i];
         }
-
-        return new Lh5CompressorInputStream(new ByteArrayInputStream(bytes));
+        return 
LhStaticHuffmanCompressorInputStream.lh5CompressorInputStream(new 
ByteArrayInputStream(bytes));
     }
 
     @Test
     void testInputStreamStatistics() throws IOException {
-        final int[] compressedData = {
-            0x00, 0x05, 0x28, 0x04, 0x4b, 0xfc, 0x16, 0xed,
-            0x37, 0x00, 0x43, 0x00
-        };
-
-        try (Lh5CompressorInputStream in = 
createLh5CompressorInputStream(compressedData)) {
+        final int[] compressedData = { 0x00, 0x05, 0x28, 0x04, 0x4b, 0xfc, 
0x16, 0xed, 0x37, 0x00, 0x43, 0x00 };
+        try (LhStaticHuffmanCompressorInputStream in = 
createLh5CompressorInputStream(compressedData)) {
             final byte[] decompressedData = IOUtils.toByteArray(in);
-
             assertEquals(1024, decompressedData.length);
             for (int i = 0; i < decompressedData.length; i++) {
                 assertEquals('A', decompressedData[i], "Byte at position " + 
i);
             }
-
             assertEquals(12, in.getCompressedCount());
             assertEquals(1024, in.getUncompressedCount());
         }
@@ -63,26 +60,25 @@ void testInputStreamStatistics() throws IOException {
 
     @Test
     void testReadCodeLength() throws IOException {
-        assertEquals(0, createLh5CompressorInputStream(0x00, 
0x00).readCodeLength());  // 0000 0000  0000 0000
-        assertEquals(1, createLh5CompressorInputStream(0x20, 
0x00).readCodeLength());  // 0010 0000  0000 0000
-        assertEquals(2, createLh5CompressorInputStream(0x40, 
0x00).readCodeLength());  // 0100 0000  0000 0000
-        assertEquals(3, createLh5CompressorInputStream(0x60, 
0x00).readCodeLength());  // 0110 0000  0000 0000
-        assertEquals(4, createLh5CompressorInputStream(0x80, 
0x00).readCodeLength());  // 1000 0000  0000 0000
-        assertEquals(5, createLh5CompressorInputStream(0xa0, 
0x00).readCodeLength());  // 1010 0000  0000 0000
-        assertEquals(6, createLh5CompressorInputStream(0xc0, 
0x00).readCodeLength());  // 1100 0000  0000 0000
-        assertEquals(7, createLh5CompressorInputStream(0xe0, 
0x00).readCodeLength());  // 1110 0000  0000 0000
-        assertEquals(8, createLh5CompressorInputStream(0xf0, 
0x00).readCodeLength());  // 1111 0000  0000 0000
-        assertEquals(9, createLh5CompressorInputStream(0xf8, 
0x00).readCodeLength());  // 1111 1000  0000 0000
-        assertEquals(10, createLh5CompressorInputStream(0xfc, 
0x00).readCodeLength()); // 1111 1100  0000 0000
-        assertEquals(11, createLh5CompressorInputStream(0xfe, 
0x00).readCodeLength()); // 1111 1110  0000 0000
-        assertEquals(12, createLh5CompressorInputStream(0xff, 
0x00).readCodeLength()); // 1111 1111  0000 0000
-        assertEquals(13, createLh5CompressorInputStream(0xff, 
0x80).readCodeLength()); // 1111 1111  1000 0000
-        assertEquals(14, createLh5CompressorInputStream(0xff, 
0xc0).readCodeLength()); // 1111 1111  1100 0000
-        assertEquals(15, createLh5CompressorInputStream(0xff, 
0xe0).readCodeLength()); // 1111 1111  1110 0000
-        assertEquals(16, createLh5CompressorInputStream(0xff, 
0xf0).readCodeLength()); // 1111 1111  1111 0000
-
+        assertEquals(0, createLh5CompressorInputStream(0x00, 
0x00).readCodeLength()); // 0000 0000 0000 0000
+        assertEquals(1, createLh5CompressorInputStream(0x20, 
0x00).readCodeLength()); // 0010 0000 0000 0000
+        assertEquals(2, createLh5CompressorInputStream(0x40, 
0x00).readCodeLength()); // 0100 0000 0000 0000
+        assertEquals(3, createLh5CompressorInputStream(0x60, 
0x00).readCodeLength()); // 0110 0000 0000 0000
+        assertEquals(4, createLh5CompressorInputStream(0x80, 
0x00).readCodeLength()); // 1000 0000 0000 0000
+        assertEquals(5, createLh5CompressorInputStream(0xa0, 
0x00).readCodeLength()); // 1010 0000 0000 0000
+        assertEquals(6, createLh5CompressorInputStream(0xc0, 
0x00).readCodeLength()); // 1100 0000 0000 0000
+        assertEquals(7, createLh5CompressorInputStream(0xe0, 
0x00).readCodeLength()); // 1110 0000 0000 0000
+        assertEquals(8, createLh5CompressorInputStream(0xf0, 
0x00).readCodeLength()); // 1111 0000 0000 0000
+        assertEquals(9, createLh5CompressorInputStream(0xf8, 
0x00).readCodeLength()); // 1111 1000 0000 0000
+        assertEquals(10, createLh5CompressorInputStream(0xfc, 
0x00).readCodeLength()); // 1111 1100 0000 0000
+        assertEquals(11, createLh5CompressorInputStream(0xfe, 
0x00).readCodeLength()); // 1111 1110 0000 0000
+        assertEquals(12, createLh5CompressorInputStream(0xff, 
0x00).readCodeLength()); // 1111 1111 0000 0000
+        assertEquals(13, createLh5CompressorInputStream(0xff, 
0x80).readCodeLength()); // 1111 1111 1000 0000
+        assertEquals(14, createLh5CompressorInputStream(0xff, 
0xc0).readCodeLength()); // 1111 1111 1100 0000
+        assertEquals(15, createLh5CompressorInputStream(0xff, 
0xe0).readCodeLength()); // 1111 1111 1110 0000
+        assertEquals(16, createLh5CompressorInputStream(0xff, 
0xf0).readCodeLength()); // 1111 1111 1111 0000
         try {
-            createLh5CompressorInputStream(0xff, 0xf8).readCodeLength(); // 
1111 1111  1111 1000
+            createLh5CompressorInputStream(0xff, 0xf8).readCodeLength(); // 
1111 1111 1111 1000
             fail("Expected CompressorException for code length overflow");
         } catch (final CompressorException e) {
             assertEquals("Code length overflow", e.getMessage());
@@ -92,7 +88,7 @@ void testReadCodeLength() throws IOException {
     @Test
     void testReadCodeLengthUnexpectedEndOfStream() throws IOException {
         try {
-            createLh5CompressorInputStream(0xff).readCodeLength(); // 1111 
1111  EOF
+            createLh5CompressorInputStream(0xff).readCodeLength(); // 1111 
1111 EOF
             fail("Expected CompressorException for unexpected end of stream");
         } catch (final CompressorException e) {
             assertEquals("Unexpected end of stream", e.getMessage());
@@ -102,10 +98,8 @@ void testReadCodeLengthUnexpectedEndOfStream() throws 
IOException {
     @Test
     void testReadCommandDecodingTreeWithInvalidSize() throws IOException {
         try {
-            createLh5CompressorInputStream(
-                0b10100000, 0b00000000 // 5 bits length (0x14 = 20)
+            createLh5CompressorInputStream(0b10100000, 0b00000000 // 5 bits 
length (0x14 = 20)
             ).readCommandDecodingTree();
-
             fail("Expected CompressorException for table invalid size");
         } catch (final CompressorException e) {
             assertEquals("Code length table has invalid size (20 > 19)", 
e.getMessage());
@@ -114,18 +108,16 @@ void testReadCommandDecodingTreeWithInvalidSize() throws 
IOException {
 
     @Test
     void testReadCommandDecodingTreeWithSingleValue() throws IOException {
-        final BinaryTree tree = createLh5CompressorInputStream(
-            0b00000000, 0b00111111 // 5 bits length (0x00) and 5 bits the root 
value (0x00)
+        final BinaryTree tree = createLh5CompressorInputStream(0b00000000, 
0b00111111 // 5 bits length (0x00) and 5 bits the root value (0x00)
         ).readCommandDecodingTree();
-
         assertEquals(0, tree.read(new BitInputStream(new 
ByteArrayInputStream(new byte[0]), ByteOrder.BIG_ENDIAN)));
     }
 
     @Test
     void testReadCommandTreeUnexpectedEndOfStream() throws IOException {
         try {
-            createLh5CompressorInputStream(
-                0b00000000, 0b01111111 // 9 bits length (0x00) and only 8 bits 
instead of expected 9 bits which will cause an unexpected end of stream
+            createLh5CompressorInputStream(0b00000000, 0b01111111 // 9 bits 
length (0x00) and only 8 bits instead of expected 9 bits which will cause an
+                                                                  // 
unexpected end of stream
             ).readCommandTree(new BinaryTree(0));
             fail("Expected CompressorException for unexpected end of stream");
         } catch (final CompressorException e) {
@@ -136,10 +128,8 @@ void testReadCommandTreeUnexpectedEndOfStream() throws 
IOException {
     @Test
     void testReadCommandTreeWithInvalidSize() throws IOException {
         try {
-            createLh5CompressorInputStream(
-                0b11111111, 0b10000000 // 9 bits length (0x01ff = 511)
+            createLh5CompressorInputStream(0b11111111, 0b10000000 // 9 bits 
length (0x01ff = 511)
             ).readCommandTree(new BinaryTree(0));
-
             fail("Expected CompressorException for table invalid size");
         } catch (final CompressorException e) {
             assertEquals("Code length table has invalid size (511 > 510)", 
e.getMessage());
@@ -148,10 +138,9 @@ void testReadCommandTreeWithInvalidSize() throws 
IOException {
 
     @Test
     void testReadCommandTreeWithSingleValue() throws IOException {
-        final BinaryTree tree = createLh5CompressorInputStream(
-            0b00000000, 0b01111111, 0b01000000 // 9 bits length (0x00) and 9 
bits the root value (0x01fd = 509)
+        final BinaryTree tree = createLh5CompressorInputStream(0b00000000, 
0b01111111, 0b01000000 // 9 bits length (0x00) and 9 bits the root value 
(0x01fd =
+                                                                               
                   // 509)
         ).readCommandTree(new BinaryTree(0));
-
         assertEquals(0x01fd, tree.read(new BitInputStream(new 
ByteArrayInputStream(new byte[0]), ByteOrder.BIG_ENDIAN)));
     }
 }

Reply via email to