@@ -0,0 +1,2568 @@
+package com.op1.iff;%0A%0Aimport com.op1.iff.types.*;%0A%0Aimport java.io.DataInputStream;%0Aimport java.io.EOFException;%0Aimport java.io.IOException;%0A%0Apublic class IffReader %7B%0A%0A    private final DataInputStream dataInputStream;%0A%0A    public IffReader(DataInputStream dataInputStream) %7B%0A        this.dataInputStream = dataInputStream;%0A    %7D%0A%0A    public SignedChar readSignedChar() throws IOException %7B%0A        return new SignedChar(dataInputStream.readByte());%0A    %7D%0A%0A    public UnsignedChar readUnsignedChar() throws IOException %7B%0A        return new UnsignedChar(dataInputStream.readByte());%0A    %7D%0A%0A    public SignedShort readSignedShort() throws IOException %7B%0A        return new SignedShort(readBytes(2));%0A    %7D%0A%0A    public UnsignedShort readUnsignedShort() throws IOException %7B%0A        return new UnsignedShort(readBytes(2));%0A    %7D%0A%0A    public SignedLong readSignedLong() throws IOException %7B%0A        return new SignedLong(readBytes(4));%0A    %7D%0A%0A    public UnsignedLong readUnsignedLong() throws IOException %7B%0A        return new UnsignedLong(readBytes(4));%0A    %7D%0A%0A    public Extended readExtended() throws IOException %7B%0A        return new Extended(readBytes(10));%0A    %7D%0A%0A    public PString readPString() throws IOException %7B%0A%0A        // The first byte contains a count of the text textBytes that follow.%0A        final int numTextBytes = dataInputStream.readUnsignedByte();%0A%0A        // Read the text bytes.%0A        final byte%5B%5D textBytes = readBytes(numTextBytes);%0A%0A%0A        // The total number of textBytes should be even. A pad byte may have been added to satisfy this rule.%0A        int numPadBytes = (numTextBytes + 1) %25 2;%0A%0A        byte%5B%5D pStringBytes = new byte%5B1 + numTextBytes + numPadBytes%5D;%0A        pStringBytes%5B0%5D = (byte) numTextBytes;%0A        System.arraycopy(textBytes, 0, pStringBytes, 1, textBytes.length);%0A        if (numPadBytes == 1) %7B%0A            pStringBytes%5BpStringBytes.length - 1%5D = dataInputStream.readByte();%0A        %7D%0A        return new PString(pStringBytes);%0A    %7D%0A%0A    public ID readID() throws IOException %7B%0A        return new ID(readBytes(4));%0A    %7D%0A%0A    public OSType readOSType() throws IOException %7B%0A        return new OSType(readBytes(4));%0A    %7D%0A%0A    public byte%5B%5D readBytes(int numBytesToRead) throws IOException %7B%0A        final byte%5B%5D bytes = new byte%5BnumBytesToRead%5D;%0A        final int numRead = dataInputStream.read(bytes);%0A        if (numRead != numBytesToRead) %7B%0A            throw new EOFException();%0A        %7D%0A        return bytes;%0A    %7D%0A%0A    public byte readByte() throws IOException %7B%0A        return dataInputStream.readByte();%0A    %7D%0A%7D%0A

Create IffReader.java