// Path: op1/src/main/java/com/op1/iff/Chunk.java
// public interface Chunk {
// 
//     /**
//      * Returns the ID of this chunk.
//      */
//     ID getChunkID();
// 
//     /**
//      * Returns the size in bytes of the data portion of the chunk. The count does not include the 8 bytes used by the
//      * chunk ID and chunk size. Also, please note, when the data portion of a chunk contains an odd number of bytes,
//      * chunk readers should expect to read an extra pad byte (0) which is also not included in the chunk size count.
//      */
//     SignedLong getChunkSize();
// 
//     /**
//      * Returns the actual number of bytes used to represent this Chunk. This should be equal to the value returned by
//      * getChunkSize() + 8 [+1 if getChunkSize() is odd].
//      */
//     int getPhysicalSize();
// }
// 
// Path: op1/src/main/java/com/op1/iff/IffReader.java
// public class IffReader implements Closeable {
// 
//     private final DataInputStream dataInputStream;
// 
//     public IffReader(DataInputStream dataInputStream) {
//         this.dataInputStream = dataInputStream;
//     }
// 
//     public SignedChar readSignedChar() throws IOException {
//         return new SignedChar(dataInputStream.readByte());
//     }
// 
//     public UnsignedChar readUnsignedChar() throws IOException {
//         return new UnsignedChar(dataInputStream.readByte());
//     }
// 
//     public SignedShort readSignedShort() throws IOException {
//         return new SignedShort(readBytes(2));
//     }
// 
//     public UnsignedShort readUnsignedShort() throws IOException {
//         return new UnsignedShort(readBytes(2));
//     }
// 
//     public SignedLong readSignedLong() throws IOException {
//         return new SignedLong(readBytes(4));
//     }
// 
//     public UnsignedLong readUnsignedLong() throws IOException {
//         return new UnsignedLong(readBytes(4));
//     }
// 
//     public Extended readExtended() throws IOException {
//         return new Extended(readBytes(10));
//     }
// 
//     public PString readPString() throws IOException {
// 
//         // The first byte contains a count of the text textBytes that follow.
//         final int numTextBytes = dataInputStream.readUnsignedByte();
// 
//         // Read the text bytes.
//         final byte[] textBytes = readBytes(numTextBytes);
// 
//         // The total number of textBytes should be even. A pad byte may have been added to satisfy this rule.
//         int numPadBytes = (numTextBytes + 1) % 2;
// 
//         byte[] pStringBytes = new byte[1 + numTextBytes + numPadBytes];
//         pStringBytes[0] = (byte) numTextBytes;
//         System.arraycopy(textBytes, 0, pStringBytes, 1, textBytes.length);
//         if (numPadBytes == 1) {
//             pStringBytes[pStringBytes.length - 1] = dataInputStream.readByte();
//         }
//         return new PString(pStringBytes);
//     }
// 
//     public ID readID() throws IOException {
//         return new ID(readBytes(4));
//     }
// 
//     public OSType readOSType() throws IOException {
//         return new OSType(readBytes(4));
//     }
// 
//     public byte[] readBytes(int numBytesToRead) throws IOException {
//         final byte[] bytes = new byte[numBytesToRead];
//         final int numRead = dataInputStream.read(bytes);
//         if (numRead != numBytesToRead) {
//             throw new EOFException(String.format("numBytesToRead: %s, numRead: %s", numBytesToRead, numRead));
//         }
//         return bytes;
//     }
// 
//     public byte readByte() throws IOException {
//         return dataInputStream.readByte();
//     }
// 
//     public void close() throws IOException {
//         dataInputStream.close();
//     }
// }
// 
// Path: op1/src/main/java/com/op1/iff/types/ID.java
// public class ID extends DataType {
// 
//     private final String name;
// 
//     public ID(byte[] bytes) {
//         // TODO: ahem, validation?
//         super(bytes, 4);
//         this.name = new String(bytes);
//     }
// 
//     public static ID valueOf(String s) {
//         return new ID(s.getBytes());
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String toString() {
//         return getName();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         final ID id = (ID) o;
// 
//         return Arrays.equals(bytes, id.bytes);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         return Arrays.hashCode(bytes);
//     }
// }
// 
// Path: op1/src/main/java/com/op1/util/Check.java
// public class Check {
// 
//     public static <T> T notNull(T t, String message) {
//         if (t == null) {
//             throw new IllegalArgumentException(message);
//         }
//         return t;
//     }
// 
//     public static void that(boolean b, String message) {
//         if (!b) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static void state(boolean b, String message) {
//         if (!b) {
//             throw new IllegalStateException(message);
//         }
//     }
// }


import com.op1.iff.Chunk;
import com.op1.iff.IffReader;
import com.op1.iff.types.ID;
import com.op1.util.Check;
import java.io.IOException;
    }

    public ID getChunkId() {
        return id;
    }

    public Chunk readChunk(IffReader reader) throws IOException {
        return chunkReader.readChunk(reader);
    }

    public static ChunkType fromName(String name) {
        for (ChunkType chunkType : ChunkType.values()) {
            if (chunkType.name.equals(name)) {
                return chunkType;
            }
        }
        throw new IllegalArgumentException("Unrecognized chunk");
    }

    public static boolean isKnownChunk(String name) {
        for (ChunkType chunkType : ChunkType.values()) {
            if (chunkType.name.equals(name)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isChunkType(Chunk chunk, ChunkType chunkType) {
        Check.notNull(chunk, "Chunk is null");
// Path: op1/src/main/java/com/op1/iff/Chunk.java
// public interface Chunk {
// 
//     /**
//      * Returns the ID of this chunk.
//      */
//     ID getChunkID();
// 
//     /**
//      * Returns the size in bytes of the data portion of the chunk. The count does not include the 8 bytes used by the
//      * chunk ID and chunk size. Also, please note, when the data portion of a chunk contains an odd number of bytes,
//      * chunk readers should expect to read an extra pad byte (0) which is also not included in the chunk size count.
//      */
//     SignedLong getChunkSize();
// 
//     /**
//      * Returns the actual number of bytes used to represent this Chunk. This should be equal to the value returned by
//      * getChunkSize() + 8 [+1 if getChunkSize() is odd].
//      */
//     int getPhysicalSize();
// }
// 
// Path: op1/src/main/java/com/op1/iff/IffReader.java
// public class IffReader implements Closeable {
// 
//     private final DataInputStream dataInputStream;
// 
//     public IffReader(DataInputStream dataInputStream) {
//         this.dataInputStream = dataInputStream;
//     }
// 
//     public SignedChar readSignedChar() throws IOException {
//         return new SignedChar(dataInputStream.readByte());
//     }
// 
//     public UnsignedChar readUnsignedChar() throws IOException {
//         return new UnsignedChar(dataInputStream.readByte());
//     }
// 
//     public SignedShort readSignedShort() throws IOException {
//         return new SignedShort(readBytes(2));
//     }
// 
//     public UnsignedShort readUnsignedShort() throws IOException {
//         return new UnsignedShort(readBytes(2));
//     }
// 
//     public SignedLong readSignedLong() throws IOException {
//         return new SignedLong(readBytes(4));
//     }
// 
//     public UnsignedLong readUnsignedLong() throws IOException {
//         return new UnsignedLong(readBytes(4));
//     }
// 
//     public Extended readExtended() throws IOException {
//         return new Extended(readBytes(10));
//     }
// 
//     public PString readPString() throws IOException {
// 
//         // The first byte contains a count of the text textBytes that follow.
//         final int numTextBytes = dataInputStream.readUnsignedByte();
// 
//         // Read the text bytes.
//         final byte[] textBytes = readBytes(numTextBytes);
// 
//         // The total number of textBytes should be even. A pad byte may have been added to satisfy this rule.
//         int numPadBytes = (numTextBytes + 1) % 2;
// 
//         byte[] pStringBytes = new byte[1 + numTextBytes + numPadBytes];
//         pStringBytes[0] = (byte) numTextBytes;
//         System.arraycopy(textBytes, 0, pStringBytes, 1, textBytes.length);
//         if (numPadBytes == 1) {
//             pStringBytes[pStringBytes.length - 1] = dataInputStream.readByte();
//         }
//         return new PString(pStringBytes);
//     }
// 
//     public ID readID() throws IOException {
//         return new ID(readBytes(4));
//     }
// 
//     public OSType readOSType() throws IOException {
//         return new OSType(readBytes(4));
//     }
// 
//     public byte[] readBytes(int numBytesToRead) throws IOException {
//         final byte[] bytes = new byte[numBytesToRead];
//         final int numRead = dataInputStream.read(bytes);
//         if (numRead != numBytesToRead) {
//             throw new EOFException(String.format("numBytesToRead: %s, numRead: %s", numBytesToRead, numRead));
//         }
//         return bytes;
//     }
// 
//     public byte readByte() throws IOException {
//         return dataInputStream.readByte();
//     }
// 
//     public void close() throws IOException {
//         dataInputStream.close();
//     }
// }
// 
// Path: op1/src/main/java/com/op1/iff/types/ID.java
// public class ID extends DataType {
// 
//     private final String name;
// 
//     public ID(byte[] bytes) {
//         // TODO: ahem, validation?
//         super(bytes, 4);
//         this.name = new String(bytes);
//     }
// 
//     public static ID valueOf(String s) {
//         return new ID(s.getBytes());
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String toString() {
//         return getName();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         final ID id = (ID) o;
// 
//         return Arrays.equals(bytes, id.bytes);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         return Arrays.hashCode(bytes);
//     }
// }
// 
// Path: op1/src/main/java/com/op1/util/Check.java
// public class Check {
// 
//     public static <T> T notNull(T t, String message) {
//         if (t == null) {
//             throw new IllegalArgumentException(message);
//         }
//         return t;
//     }
// 
//     public static void that(boolean b, String message) {
//         if (!b) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static void state(boolean b, String message) {
//         if (!b) {
//             throw new IllegalStateException(message);
//         }
//     }
// }


// Path: op1/src/main/java/com/op1/aiff/ChunkType.java
import com.op1.iff.Chunk;
import com.op1.iff.IffReader;
import com.op1.iff.types.ID;
import com.op1.util.Check;
import java.io.IOException;

    }

    public ID getChunkId() {
        return id;
    }

    public Chunk readChunk(IffReader reader) throws IOException {
        return chunkReader.readChunk(reader);
    }

    public static ChunkType fromName(String name) {
        for (ChunkType chunkType : ChunkType.values()) {
            if (chunkType.name.equals(name)) {
                return chunkType;
            }
        }
        throw new IllegalArgumentException("Unrecognized chunk");
    }

    public static boolean isKnownChunk(String name) {
        for (ChunkType chunkType : ChunkType.values()) {
            if (chunkType.name.equals(name)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isChunkType(Chunk chunk, ChunkType chunkType) {
        Check.notNull(chunk, "Chunk is null");
        Check.notNull(chunkType, "ChunkType is null");