Moved bit input and output streams into Svjatoslav Commons library.
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / codec / BitOutputStream.java
diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitOutputStream.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/BitOutputStream.java
deleted file mode 100755 (executable)
index 469bb7b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package eu.svjatoslav.imagesqueeze.codec;
-
-/**
- * Write individual bits to the output stream.
- */
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class BitOutputStream {
-
-       int currentByte;
-       int currentBytePointer;
-       
-       OutputStream outputStream;
-
-       public BitOutputStream(OutputStream outputStream){
-               currentByte = 0;
-               currentBytePointer = 0;
-               this.outputStream = outputStream;
-       };
-
-
-       public void storeBits(int data, int bitCount) throws IOException {
-               for (int i=bitCount-1; i >= 0; i--){
-
-                       int mask = 1;
-                       mask = mask << i;
-
-                       int currentBit = data & mask;
-                       currentByte = currentByte << 1;
-
-                       if (currentBit != 0){
-                               currentByte = currentByte | 1;
-                       }
-                       currentBytePointer++;
-
-                       if (currentBytePointer == 8){
-                               currentBytePointer = 0;
-                               outputStream.write(currentByte);
-                               currentByte = 0;
-                       }
-               }
-       }
-
-       public void storeIntegerCompressed8(int data) throws IOException{
-               if (data < 256){
-                       storeBits(0, 1);
-                       storeBits(data, 8);
-               } else {
-                       storeBits(1, 1);
-                       storeBits(data, 32);                    
-               }               
-       }
-
-       public void finishByte() throws IOException {
-               if (currentBytePointer != 0){
-                       outputStream.write(currentByte);                                        
-                       currentBytePointer = 0;
-               }
-       }       
-
-}