public void read(MC68000InputStream in) throws IOException {
   id = in.readLONG();
   long length = in.readULONG();
   switch (id) {
     case ID_CAT:
     case ID_FORM:
     case ID_LIST:
     case ID_PROP:
       type = in.readLONG();
       length -= 4;
       while (length > 1) {
         MutableIFFChunk child = new MutableIFFChunk();
         child.read(in);
         add(child);
         int childLength = child.getLength();
         length -= childLength + childLength % 2 + 8;
       }
       break;
     default:
       data = new byte[(int) length];
       in.readFully(data, 0, (int) length);
       break;
   }
   if (length % 2 == 1) {
     in.read();
   }
 }
 public int getLength() {
   if (data != null) {
     return data.length;
   } else {
     int length = 4;
     for (MutableIFFChunk child : childChunks()) {
       int childLength = child.getLength();
       length += 8 + childLength + childLength % 2;
     }
     return length;
   }
 }