Documentation of 'org.freehep.util.io.BitOutputStream' Java class
BitOutputStream
org.freehep.util.io

Class BitOutputStream

    • Constructor Summary

      Constructors 
      Constructor and Description
      BitOutputStream(java.io.OutputStream out)
      Create a Bit output stream from given stream
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void byteAlign()
      A utility to force the next write to be byte-aligned.
      void close() 
      void finish()
      Finishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.
      static int minBits(float number)
      calculates the minumum number of bits necessary to write number.
      static int minBits(long number) 
      static int minBits(long number, boolean signed) 
      void write(int b) 
      void writeBitFlag(boolean bit)
      Write a bit to the output stream.
      void writeFBits(float value, int n)
      Write a float value of n-bits to the stream.
      void writeSBits(long value, int n)
      Write a signed value of n-bits to the output stream.
      void writeUBits(long value, int n)
      Write an unsigned value of n-bits to the output stream.
      • Methods inherited from class java.io.FilterOutputStream

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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitOutputStream

        public BitOutputStream(java.io.OutputStream out)
        Create a Bit output stream from given stream
        Parameters:
        out - stream to write to
    • Method Detail

      • finish

        public void finish()
                    throws java.io.IOException
        Description copied from interface: FinishableOutputStream
        Finishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.
        Specified by:
        finish in interface FinishableOutputStream
        Overrides:
        finish in class CompressableOutputStream
        Throws:
        java.io.IOException - if write fails
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class CompressableOutputStream
        Throws:
        java.io.IOException
      • byteAlign

        public void byteAlign()
                       throws java.io.IOException
        A utility to force the next write to be byte-aligned.
        Throws:
        java.io.IOException - if write fails
      • writeBitFlag

        public void writeBitFlag(boolean bit)
                          throws java.io.IOException
        Write a bit to the output stream. A 1-bit is true; a 0-bit is false.
        Parameters:
        bit - value to write
        Throws:
        java.io.IOException - if write fails
      • writeSBits

        public void writeSBits(long value,
                               int n)
                        throws java.io.IOException
        Write a signed value of n-bits to the output stream.
        Parameters:
        value - value to write
        n - number of bits to write
        Throws:
        java.io.IOException - if write fails
      • writeFBits

        public void writeFBits(float value,
                               int n)
                        throws java.io.IOException
        Write a float value of n-bits to the stream.
        Parameters:
        value - value to write
        n - number of bits to write
        Throws:
        java.io.IOException - if write fails
      • writeUBits

        public void writeUBits(long value,
                               int n)
                        throws java.io.IOException
        Write an unsigned value of n-bits to the output stream.
        Parameters:
        value - value to write
        n - number of bits to write
        Throws:
        java.io.IOException - if write fails
      • minBits

        public static int minBits(float number)
        calculates the minumum number of bits necessary to write number.
        Parameters:
        number - number
        Returns:
        minimum number of bits to store number
      • minBits

        public static int minBits(long number)
        Parameters:
        number - value to calculate bits for
        Returns:
        number of bits needed to store value
      • minBits

        public static int minBits(long number,
                                  boolean signed)
        Parameters:
        number - value to calculate bits for
        signed - true if the value if signed (< 0)
        Returns:
        number of bits needed to store value

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.