fi.helsinki.cs.ohtu.mpeg2.util
Enum BitOutputStream.BitOrder

java.lang.Object
  extended by java.lang.Enum<BitOutputStream.BitOrder>
      extended by fi.helsinki.cs.ohtu.mpeg2.util.BitOutputStream.BitOrder
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<BitOutputStream.BitOrder>
Enclosing class:
BitOutputStream

public static enum BitOutputStream.BitOrder
extends java.lang.Enum<BitOutputStream.BitOrder>

This enum specifies the bit order used.


Enum Constant Summary
LEAST_SIGNIFICANT_FIRST
          The least significant bit is written first.
MOST_SIGNIFICANT_FIRST
          The most significant bit is written first.
 
Field Summary
private  int initial
           
private  int shift
           
 
Method Summary
(package private)  int getInitial()
          Returns the first bit to be set in a byte.
(package private)  int getShift()
          Returns the shift amount.
static BitOutputStream.BitOrder valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static BitOutputStream.BitOrder[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

MOST_SIGNIFICANT_FIRST

public static final BitOutputStream.BitOrder MOST_SIGNIFICANT_FIRST
The most significant bit is written first. This corresponds to "left-to-right" order. The first bit written to the stream is written as the most significant bit of the first byte to be written to the underlying stream. Following bits are written to progressively less significant bits, wrapping around to the most significant bit of the next byte after 8 bits.


LEAST_SIGNIFICANT_FIRST

public static final BitOutputStream.BitOrder LEAST_SIGNIFICANT_FIRST
The least significant bit is written first. This corresponds to "right-to-left" order. The first bit written to the stream is written as the least significant bit of the first byte to be written to the underlying stream. Following bits are written to progressively more significant bits, wrapping around to the least significant bit of the next byte after 8 bits.

Field Detail

initial

private final int initial

shift

private final int shift
Method Detail

values

public static BitOutputStream.BitOrder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (BitOutputStream.BitOrder c : BitOutputStream.BitOrder.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BitOutputStream.BitOrder valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getInitial

int getInitial()
Returns the first bit to be set in a byte.

Returns:
A bit mask with a single bit set, indicating the location of the bit to set first.

getShift

int getShift()
Returns the shift amount. The shift amount indicates how much a bit location mask should be shifted to get the location mask giving the next bit to set. Positive values indicate a shift to the left while negative values indicate a shift to the right.

Returns:
The amount to shift.