Class MyBitOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class MyBitOutputStream
    extends java.io.OutputStream
    • Constructor Summary

      Constructors 
      Constructor Description
      MyBitOutputStream​(java.io.OutputStream os, java.nio.ByteOrder byteOrder)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void actualWrite​(int value)  
      void flushCache()  
      int getBytesWritten()  
      void write​(int value)  
      void writeBits​(int value, int sampleBits)  
      • Methods inherited from class java.io.OutputStream

        close, flush, write, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • os

        private final java.io.OutputStream os
      • byteOrder

        private final java.nio.ByteOrder byteOrder
      • bitsInCache

        private int bitsInCache
      • bitCache

        private int bitCache
      • bytesWritten

        private int bytesWritten
    • Constructor Detail

      • MyBitOutputStream

        public MyBitOutputStream​(java.io.OutputStream os,
                                 java.nio.ByteOrder byteOrder)
    • Method Detail

      • write

        public void write​(int value)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • writeBits

        public void writeBits​(int value,
                              int sampleBits)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • actualWrite

        private void actualWrite​(int value)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • flushCache

        public void flushCache()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getBytesWritten

        public int getBytesWritten()