Moved bit input and output streams into Svjatoslav Commons library.
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / codec / BitInputStream.java
diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitInputStream.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitInputStream.java
deleted file mode 100755 (executable)
index b5ba69a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package eu.svjatoslav.imagesqueeze.codec;
-
-/**
- * Read individual bits from the input stream.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class BitInputStream {
-
-
-       int currentByte;
-       int currentBytePointer = -1;
-
-       InputStream inputStream;
-
-       public BitInputStream(InputStream inputStream){
-               this.inputStream = inputStream;
-       }
-
-       public int readBits(int bitCount) throws IOException {
-
-               int readableByte = 0;
-               for (int i=0; i < bitCount; i++){
-
-                       readableByte = readableByte << 1;
-
-                       if (currentBytePointer == -1){
-                               currentBytePointer = 7;
-                               currentByte = inputStream.read();
-                       }
-
-                       int mask = 1;
-                       mask = mask << currentBytePointer;
-
-                       int currentBit = currentByte & mask;
-
-                       if (currentBit != 0){
-                               readableByte = readableByte | 1;
-                       }
-
-                       currentBytePointer--;
-               }
-               return readableByte;
-       }
-
-       public int readIntegerCompressed8() throws IOException{
-               if (readBits(1) == 0){
-                       return readBits(8);
-               } else {
-                       return readBits(32);                    
-               }               
-       }
-
-}