DixShtix

com.dixshtix.riff
Class FourByteConstant

java.lang.Object
  |
  +--com.dixshtix.io.IOChunkHeader
        |
        +--com.dixshtix.riff.FourByteConstant
All Implemented Interfaces:
java.lang.Comparable

public final class FourByteConstant
extends IOChunkHeader
implements java.lang.Comparable

RIFF Chunk-type identifiers.

In RIFF files, related data items are grouped into "chunks." Each chunk has a four-byte ASCII Chunk identifier, followed immediately by a four-byte binary representation of the length of the remainder of the chunk. The Chunk identifier is to be composed only of upper and lowercase ASCII letters and may be padded on the right with ASCII spaces.

Chunks of type RIFF or RIFX are top-level containers of little-endian or big-endian data, respectively. These containers are called Forms in Microsoft parlance. The first four bytes of the interior of a Form can be combined with the type of the container to form a unique 8-byte identifier for the Form.

Chunks of type LIST are internal containers of LISTs and Chunks. Like all Chunks, LISTs have a length. Like the Form Chunks, the first four bytes of a LIST's interior contain a LIST type identifier.


Field Summary
 int code
          Internal representation.
private static java.util.HashMap fccToNames
          Cache for speedy toString() operation.
static FourByteConstant IARL
          Archival Location.
static FourByteConstant IART
          Artist.
static FourByteConstant ICMS
          Commissioned.
static FourByteConstant ICMT
          Comments.
static FourByteConstant ICOP
          Copyright.
static FourByteConstant ICRD
          Creation date.
static FourByteConstant ICRP
          Cropped.
static FourByteConstant IDIM
          Dimensions.
static FourByteConstant IDPI
          Dots Per Inch.
static FourByteConstant IENG
          Engineer.
static FourByteConstant IGNR
          Genre.
static FourByteConstant IKEY
          Keywords.
static FourByteConstant ILGT
          Lightness.
static FourByteConstant IMED
          Medium.
static FourByteConstant INAM
          Name.
static FourByteConstant INFO
          List type.
static FourByteConstant IPLT
          Palette Setting.
static FourByteConstant IPRD
          Product.
static FourByteConstant ISBJ
          Subject.
static FourByteConstant ISFT
          Software.
static FourByteConstant ISHP
          Sharpness.
static FourByteConstant ISRC
          Source.
static FourByteConstant ISRF
          Source Form.
static FourByteConstant ITCH
          Technician.
static FourByteConstant JUNK
          RIFF standard chunk type for padding bytes.
static FourByteConstant LIST
          Container type, has associated LIST type.
private static java.util.HashMap namesToFCC
          Reverse-lookup converting long strings to FourByteConstants.
static FourByteConstant RIFF
          Form type, Little-endian.
static FourByteConstant RIFX
          Form type, Big-endian.
private  java.lang.String stringValue
          Optional string value.
 
Constructor Summary
  FourByteConstant(byte b0, byte b1, byte b2, byte b3)
          Purest constructor.
  FourByteConstant(char c0, char c1, char c2, char c3)
          ASCII Character constructor.
protected FourByteConstant(int code)
          Internal constructor.
  FourByteConstant(java.lang.String s)
          Easy Constructor.
  FourByteConstant(java.lang.String s, java.lang.String name)
          Associate a name with a four-byte-constant.
 
Method Summary
 int compareTo(int fcc)
          Directional ordering of FourByteConstants and integers.
 int compareTo(java.lang.Object o)
          Directional ordering of FourByteConstants.
 boolean equals(int fcc)
          Test for equality of contents.
 boolean equals(java.lang.Object fcc)
          Test for equality of contents.
 int getLength()
           
 int hashCode()
          Compute hash code based on contents of the FourByteConstant.
 boolean isValid()
          Verifies that this is a well-formed FourByteConstant.
 java.lang.String toString()
          Most basic string representation of this FourByteConstant.
 void toString(java.io.PrintStream s)
           
 void toString(java.lang.StringBuffer b)
           
 void toString(java.io.Writer w)
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

fccToNames

private static java.util.HashMap fccToNames
Cache for speedy toString() operation.

namesToFCC

private static java.util.HashMap namesToFCC
Reverse-lookup converting long strings to FourByteConstants.

RIFF

public static final FourByteConstant RIFF
Form type, Little-endian.

RIFX

public static final FourByteConstant RIFX
Form type, Big-endian.

LIST

public static final FourByteConstant LIST
Container type, has associated LIST type.

INFO

public static final FourByteConstant INFO
List type.

IARL

public static final FourByteConstant IARL
Archival Location. Indicates where the subject of the file is archived.

IART

public static final FourByteConstant IART
Artist. Lists the artist of the original subject of the file. For example, "Michaelangelo."

ICMS

public static final FourByteConstant ICMS
Commissioned. Lists the name of the person or organization that commissioned the subject of the file. For example, "Pope Julian II."

ICMT

public static final FourByteConstant ICMT
Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include newline characters.

ICOP

public static final FourByteConstant ICOP
Copyright. Records the copyright information for the file. For example, "Copyright Encyclopedia International 1991." If there are multiple copyrights, separate them by a semicolon followed by a space.

ICRD

public static final FourByteConstant ICRD
Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left. For example, "1553-05-03" for May 3, 1553.

ICRP

public static final FourByteConstant ICRP
Cropped. Describes whether an image has been cropped and, if so, how it was cropped. For example, "lower right corner."

IDIM

public static final FourByteConstant IDIM
Dimensions. Specifies the size of the original subject of the file. For example, "8.5 in h, 11 in w."

IDPI

public static final FourByteConstant IDPI
Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as "300."

IENG

public static final FourByteConstant IENG
Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank. For example, "Smith, John; Adams, Joe."

IGNR

public static final FourByteConstant IGNR
Genre. Describes the original work, such as, "landscape," "portrait," "still life," etc.

IKEY

public static final FourByteConstant IKEY
Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank. For example, "Seattle; aerial view; scenery."

ILGT

public static final FourByteConstant ILGT
Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.

IMED

public static final FourByteConstant IMED
Medium. Describes the original subject of the file, such as, "computer image," "drawing," "lithograph," and so forth.

INAM

public static final FourByteConstant INAM
Name. Stores the title of the subject of the file, such as, "Seattle From Above."

IPLT

public static final FourByteConstant IPLT
Palette Setting. Specifies the number of colors requested when digitizing an image, such as "256."

IPRD

public static final FourByteConstant IPRD
Product. Specifies the name of the title the file was originally intended for, such as "Encyclopedia of Pacific Northwest Geography."

ISBJ

public static final FourByteConstant ISBJ
Subject. Describes the contents of the file, such as "Aerial view of Seattle."

ISFT

public static final FourByteConstant ISFT
Software. Identifies the name of the software package used to create the file, such as "Microsoft WaveEdit."

ISHP

public static final FourByteConstant ISHP
Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).

ISRC

public static final FourByteConstant ISRC
Source. Identifies the name of the person or organization who supplied the original subject of the file. For example, "Trey Research."

ISRF

public static final FourByteConstant ISRF
Source Form. Identifies the original form of the material that was digitized, such as "slide," "paper," "map," and so forth. This is not necessarily the same as IMED.

ITCH

public static final FourByteConstant ITCH
Technician. Identifies the technician who digitized the subject file. For example, "Smith, John."

JUNK

public static final FourByteConstant JUNK
RIFF standard chunk type for padding bytes.

code

public final int code
Internal representation. Big-endian four byte constant.

stringValue

private java.lang.String stringValue
Optional string value.
Constructor Detail

FourByteConstant

protected FourByteConstant(int code)
Internal constructor.
Parameters:
code - Big-endian four byte constant.

FourByteConstant

public FourByteConstant(byte b0,
                        byte b1,
                        byte b2,
                        byte b3)
Purest constructor.
Parameters:
b0 - First byte.
b1 - Second byte.
b2 - Third byte.
b3 - Fourth byte.

FourByteConstant

public FourByteConstant(char c0,
                        char c1,
                        char c2,
                        char c3)
ASCII Character constructor.
Parameters:
c0 - First character.
c1 - Second character.
c2 - Third character.
c3 - Fourth character.

FourByteConstant

public FourByteConstant(java.lang.String s)
Easy Constructor.
Parameters:
s - A four-char alphanumeric string.

FourByteConstant

public FourByteConstant(java.lang.String s,
                        java.lang.String name)
Associate a name with a four-byte-constant.
Parameters:
s - A four-char alphanumeric string.
name - A application-dependent name.
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Directional ordering of FourByteConstants.
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class IOChunkHeader
Parameters:
o - Another FourByteConstant.
Returns:
A number less than zero if this is "less than" o.

compareTo

public int compareTo(int fcc)
Directional ordering of FourByteConstants and integers.
Parameters:
fcc - A 32-bit big-endian representation of a FourByteConstant.
Returns:
A number less than zero if this is "less than" fcc.

equals

public boolean equals(java.lang.Object fcc)
Test for equality of contents.
Overrides:
equals in class IOChunkHeader
Parameters:
fcc - Another FourByteConstant.

getLength

public int getLength()
Overrides:
getLength in class IOChunkHeader

equals

public boolean equals(int fcc)
Test for equality of contents.
Parameters:
fcc - A 32-bit big-endian representation of a FourByteConstant.

hashCode

public int hashCode()
Compute hash code based on contents of the FourByteConstant. For this class, a.hashCode() == b.hashCode() implies a.equals(b).
Overrides:
hashCode in class java.lang.Object

isValid

public boolean isValid()
Verifies that this is a well-formed FourByteConstant. Well=formed FourByteConstants are 1-4 alphanumeric ASCII bytes, possibly right-padded with spaces.
Overrides:
isValid in class IOChunkHeader

toString

public void toString(java.lang.StringBuffer b)
Overrides:
toString in class IOChunkHeader

toString

public void toString(java.io.Writer w)
              throws java.io.IOException
Overrides:
toString in class IOChunkHeader

toString

public void toString(java.io.PrintStream s)
Overrides:
toString in class IOChunkHeader

toString

public java.lang.String toString()
Most basic string representation of this FourByteConstant.
Overrides:
toString in class java.lang.Object

DixShtix