private void writeFolder(Folder folder) throws IOException {
        writeNumber(folder.getCoders().size());
        int i;
        for (i = 0; i < folder.getCoders().size(); i++) {
            CoderInfo coder = folder.getCoders().get(i);
            {
                int propsSize = coder.getProps().getCapacity();

                long id = coder.getMethodID();
                int idSize;
                for (idSize = 1; idSize < 8; idSize++)
                    if ((id >> (8 * idSize)) == 0)
                        break;
                byte[] longID = new byte[15];
                for (int t = idSize - 1; t >= 0; t--, id >>= 8)
                    longID[t] = (byte) (id & 0xFF);
                byte b;
                b = (byte) (idSize & 0xF);
                boolean isComplex = !coder.isSimpleCoder();
                b |= (isComplex ? 0x10 : 0);
                b |= ((propsSize != 0) ? 0x20 : 0);
                writeByte(b);
                writeBytes(longID, idSize);
                if (isComplex) {
                    writeNumber(coder.getNumInStreams());
                    writeNumber(coder.getNumOutStreams());
                }
                if (propsSize == 0)
                    continue;
                writeNumber(propsSize);
                writeBytes(coder.getProps(), propsSize);
            }
        }
    }