View Javadoc

1   /***
2    * PackedBitObj is (c) 2006 Paul Brooks Andrus and is released under the MIT License:
3    * http://www.opensource.org/licenses/mit-license.php
4    * 
5    * http://www.brooksandrus.com/blog/2006/08/01/lightweight-swf-header-reader-java/
6    * package com.brooksandrus.utils.swf
7    */
8   package org.apache.portals.gems.flash;
9   
10  /***
11   * @author brooks
12   * 
13   */
14  public class PackedBitObj
15  {
16      public int    bitIndex         = 0;
17      public int    byteIndex        = 0;
18      public int    value            = 0;
19      public int    nextBitIndex     = 0;
20      public int    nextByteIndex    = 0;
21      public int    nextByteBoundary = 0;
22  
23      /***
24       * @param bitIndex
25       *           The index of the last bit read
26       * @param byteMarker
27       *           The index of the last byte read
28       * @param decimalValue
29       *           The decimal value of the packed bit sequence
30       * @param binaryString
31       *           
32       */
33      public PackedBitObj( int bitMarker, int byteMarker, int decimalValue )
34      {
35          bitIndex = bitMarker;
36          byteIndex = byteMarker;
37          value = decimalValue;
38          nextBitIndex = bitMarker;
39  
40          if ( bitMarker <= 7 )
41          {
42              nextBitIndex++;
43              nextByteIndex = byteMarker;
44              nextByteBoundary = byteMarker++;
45          }
46          else
47          {
48              nextBitIndex = 0;
49              nextByteIndex++;
50              nextByteBoundary = nextByteIndex;
51          }
52      }
53  
54  }