Class FileDicomJPEG.HuffTable

  • Enclosing class:
    FileDicomJPEG

    class FileDicomJPEG.HuffTable
    extends java.lang.Object
    This class reads and packs the bits appropriately for interpreting the huffman codes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int bitCount
      DOCUMENT ME!
      (package private) byte[] buffer
      DOCUMENT ME!
      (package private) byte current
      DOCUMENT ME!
      (package private) int index
      DOCUMENT ME!
      (package private) boolean marker
      DOCUMENT ME!
      (package private) boolean padded
      DOCUMENT ME!
      (package private) byte previous
      DOCUMENT ME!
    • Constructor Summary

      Constructors 
      Constructor Description
      HuffTable​(byte[] image, int i)
      Creates a new table with the image and the index where we stopped reading the image so far.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex()
      Returns index that we're at.
      private byte getNext()
      Gets the next byte, skipping over 0s padded in after FF.
      int huffDecode​(int tableNum)
      Returns the appropriate value after reading 8 bits and interpreting the Huffman code.
      boolean isMarker()
      Returns flag indicating if we've read in a marker.
      void setIndex​(int i)
      Sets index to parameter.
      • Methods inherited from class java.lang.Object

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

      • bitCount

        int bitCount
        DOCUMENT ME!
      • buffer

        byte[] buffer
        DOCUMENT ME!
      • current

        byte current
        DOCUMENT ME!
      • index

        int index
        DOCUMENT ME!
      • marker

        boolean marker
        DOCUMENT ME!
      • padded

        boolean padded
        DOCUMENT ME!
      • previous

        byte previous
        DOCUMENT ME!
    • Constructor Detail

      • HuffTable

        public HuffTable​(byte[] image,
                         int i)
        Creates a new table with the image and the index where we stopped reading the image so far.
        Parameters:
        image - Image.
        i - Index into image.
    • Method Detail

      • getIndex

        public int getIndex()
        Returns index that we're at.
        Returns:
        index
      • huffDecode

        public int huffDecode​(int tableNum)
        Returns the appropriate value after reading 8 bits and interpreting the Huffman code.
        Parameters:
        tableNum - DOCUMENT ME!
        Returns:
        value to add to predictor.
      • isMarker

        public boolean isMarker()
        Returns flag indicating if we've read in a marker. In that case we're off and we need to exit.
        Returns:
        true if marker has been read in.
      • setIndex

        public void setIndex​(int i)
        Sets index to parameter.
        Parameters:
        i - Index to set to.
      • getNext

        private byte getNext()
        Gets the next byte, skipping over 0s padded in after FF. Sets marker flag if we read in a marker.
        Returns:
        The next byte.