jautil
Class FourCCBytes

java.lang.Object
  extended by jautil.FourCCBytes

public class FourCCBytes
extends java.lang.Object

A representation of a Four-CC (i.e "four-character-code") tag as an array of byte values with a count. The byte values are stored in little-endian order; for convenience of conversions, any trailing bytes are forced to zero.


Field Summary
 byte[] bytes
          The byte array for this 4-cc value.
 int n
          The length, i.e.
 
Constructor Summary
FourCCBytes()
          Constructor for an empty 4-cc tag.
FourCCBytes(int tag)
          Constructs a new object for the given 4-cc tag.
FourCCBytes(int n, byte[] bb)
          Constructs a new object for the 4-cc tag defined by the given bytes and count value.
 
Method Summary
 void set(int tag4cc)
          Sets this 4-cc object to match the given 4-cc tag value -- in which the first zero-valued (or space) byte (in little-endian order) is taken to mark the end of the tag, that is, to define its length.
 void set(int n, byte[] bb)
          Sets this 4-cc object to the one defined by the given bytes and count.
 java.lang.String toString()
          Returns the string representation of this 4-cc object (implicitly using the ISO-8859-1 encoding -- that is, using the identity mapping to convert each byte to a char).
 java.lang.String toStringPadded()
          Returns the string representation of this 4-cc object, but padded with space characters if necessary to guarantee an overall length of four.
 int toTag4CC()
          Returns the integer form for this 4-cc object, padded with 0-valued bytes if necessary.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n

public int n
The length, i.e. number of non-NUL bytes, in this 4-cc value.


bytes

public byte[] bytes
The byte array for this 4-cc value.

Constructor Detail

FourCCBytes

public FourCCBytes()
Constructor for an empty 4-cc tag.


FourCCBytes

public FourCCBytes(int n,
                   byte[] bb)
Constructs a new object for the 4-cc tag defined by the given bytes and count value.


FourCCBytes

public FourCCBytes(int tag)
Constructs a new object for the given 4-cc tag.

Method Detail

set

public void set(int n,
                byte[] bb)
Sets this 4-cc object to the one defined by the given bytes and count.


set

public void set(int tag4cc)
Sets this 4-cc object to match the given 4-cc tag value -- in which the first zero-valued (or space) byte (in little-endian order) is taken to mark the end of the tag, that is, to define its length.


toString

public java.lang.String toString()
Returns the string representation of this 4-cc object (implicitly using the ISO-8859-1 encoding -- that is, using the identity mapping to convert each byte to a char). The resulting string has the same length as the four-cc tag (which may be strictly less than four).

Overrides:
toString in class java.lang.Object

toStringPadded

public java.lang.String toStringPadded()
Returns the string representation of this 4-cc object, but padded with space characters if necessary to guarantee an overall length of four. The ISO-8859-1 encoding -- that is, the identity mapping -- is used to convert each byte to a char.


toTag4CC

public int toTag4CC()
Returns the integer form for this 4-cc object, padded with 0-valued bytes if necessary.