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 2023/05/14 21:38:10 UTC

[commons-imaging] 03/10: BitsToByteInputStream now extends FilterInputStream

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-imaging.git

commit 725c88383074d2aeb23cc5033f376fe5cf420b18
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 14 17:09:52 2023 -0400

    BitsToByteInputStream now extends FilterInputStream
---
 .../commons/imaging/common/mylzw/BitsToByteInputStream.java      | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java b/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java
index da36c426..3f000875 100644
--- a/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java
@@ -16,17 +16,16 @@
  */
 package org.apache.commons.imaging.common.mylzw;
 
+import java.io.FilterInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 
 import org.apache.commons.imaging.common.Allocator;
 
-public class BitsToByteInputStream extends InputStream {
-    private final MyBitInputStream is;
+public class BitsToByteInputStream extends FilterInputStream {
     private final int desiredDepth;
 
     public BitsToByteInputStream(final MyBitInputStream is, final int desiredDepth) {
-        this.is = is;
+        super(is);
         this.desiredDepth = desiredDepth;
     }
 
@@ -36,7 +35,7 @@ public class BitsToByteInputStream extends InputStream {
     }
 
     public int readBits(final int bitCount) throws IOException {
-        int i = is.readBits(bitCount);
+        int i = ((MyBitInputStream) in).readBits(bitCount);
         if (bitCount < desiredDepth) {
             i <<= (desiredDepth - bitCount);
         } else if (bitCount > desiredDepth) {