Class MyBitOutputStream

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

    final class MyBitOutputStream
    extends java.io.FilterOutputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int bitCache  
      private int bitsInCache  
      private java.nio.ByteOrder byteOrder  
      private int bytesWritten  
      • Fields inherited from class java.io.FilterOutputStream

        out
    • 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.FilterOutputStream

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

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

      • byteOrder

        private final java.nio.ByteOrder byteOrder
      • bitsInCache

        private int bitsInCache
      • bitCache

        private int bitCache
      • bytesWritten

        private int bytesWritten
    • Constructor Detail

      • MyBitOutputStream

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

      • 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()
      • write

        public void write​(int value)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • writeBits

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