Copyright 2011-01-06 Werner Randelshofer

ch.randelshofer.media.iff
Class MutableIFFChunk

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by ch.randelshofer.media.iff.MutableIFFChunk
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class MutableIFFChunk
extends javax.swing.tree.DefaultMutableTreeNode

MutableIFFChunk.

Syntax of an IFF Chunk:

 Chunk        ::= ID #{ UBYTE* } [0]

 Property     ::= Chunk

 FORM         ::= "FORM" #{ FormType (LocalChunk | FORM | LIST | CAT)* }
 FormType     ::= ID
 LocalChunk   ::= Property | Chunk

 CAT          ::= "CAT " #{ ContentsType {FROM | LIST | CAT)* }
 ContentsType ::= ID -- a hint or an "abstract data type" ID

 LIST         ::= "LIST" #{ ContentsType PROP* {FORM | LIST | CAT)* }
 PROP         ::= "PROP" #{ FormType Property* }
 
In this extended regular expression notation the token "#" represents a count of the following braced data types. Literal items are shown in "quotes", [square bracketed items] are optional, and "*" means 0 or more instances. A sometimes-needed pad is shown as "[0]".

Version:
1.0 December 25, 2006 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
static int ID_CAT
          ID for CATGroupExpression.
static int ID_FILLER
          ID for unlabeled CATGroupExpressions.
static int ID_FORM
          ID for FORMGroupExpression.
static int ID_LIST
          ID for CATGroupExpression.
static int ID_PROP
          ID for PROPGroupExpression.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
MutableIFFChunk()
          Creates a new instance.
MutableIFFChunk(int id, byte[] data)
          Creates a new instance.
MutableIFFChunk(int id, int type)
          Creates a new instance.
MutableIFFChunk(java.lang.String id, byte[] data)
          Creates a new instance.
MutableIFFChunk(java.lang.String id, java.lang.String type)
          Creates a new instance.
 
Method Summary
 java.util.Vector<MutableIFFChunk> childChunks()
           
 java.lang.String dump()
           
 java.lang.String dump(int depth)
           
 byte[] getData()
           
 int getId()
           
 int getLength()
           
 int getType()
           
static java.lang.String idToString(int anID)
          Convert an integer IFF identifier to String.
 void read(java.io.File f)
           
 void read(MC68000InputStream in)
           
 void setData(byte[] newValue)
           
 void setId(int newValue)
           
 void setType(int newValue)
           
static int stringToId(java.lang.String aString)
          Converts the first four letters of the String into an IFF Identifier.
 java.lang.String toString()
           
 void Write(java.io.File f)
           
 void write(MC68000OutputStream out)
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_FORM

public static final int ID_FORM
ID for FORMGroupExpression.

See Also:
Constant Field Values

ID_CAT

public static final int ID_CAT
ID for CATGroupExpression.

See Also:
Constant Field Values

ID_LIST

public static final int ID_LIST
ID for CATGroupExpression.

See Also:
Constant Field Values

ID_PROP

public static final int ID_PROP
ID for PROPGroupExpression.

See Also:
Constant Field Values

ID_FILLER

public static final int ID_FILLER
ID for unlabeled CATGroupExpressions.

See Also:
Constant Field Values
Constructor Detail

MutableIFFChunk

public MutableIFFChunk()
Creates a new instance.


MutableIFFChunk

public MutableIFFChunk(int id,
                       int type)
Creates a new instance.


MutableIFFChunk

public MutableIFFChunk(int id,
                       byte[] data)
Creates a new instance.


MutableIFFChunk

public MutableIFFChunk(java.lang.String id,
                       java.lang.String type)
Creates a new instance.


MutableIFFChunk

public MutableIFFChunk(java.lang.String id,
                       byte[] data)
Creates a new instance.

Method Detail

setType

public void setType(int newValue)

setId

public void setId(int newValue)

setData

public void setData(byte[] newValue)

getType

public int getType()

getId

public int getId()

getData

public byte[] getData()

getLength

public int getLength()

childChunks

public java.util.Vector<MutableIFFChunk> childChunks()

dump

public java.lang.String dump()

dump

public java.lang.String dump(int depth)

toString

public java.lang.String toString()
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

idToString

public static java.lang.String idToString(int anID)
Convert an integer IFF identifier to String.

Parameters:
anID - to be converted.
Returns:
String representation of the ID.

stringToId

public static int stringToId(java.lang.String aString)
Converts the first four letters of the String into an IFF Identifier.

Parameters:
aString - String to be converted.
Returns:
ID representation of the String.

read

public void read(java.io.File f)
          throws java.io.IOException
Throws:
java.io.IOException

read

public void read(MC68000InputStream in)
          throws java.io.IOException
Throws:
java.io.IOException

Write

public void Write(java.io.File f)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(MC68000OutputStream out)
           throws java.io.IOException
Throws:
java.io.IOException

Copyright 2011-01-06 Werner Randelshofer