* @return
     * @throws java.io.IOException
     */
    static int readmode(BitStream inb, Code code) throws IOException {
        code.reset();
        while (!inb.atEndOfFile()) {
            int i = inb.getBits(1);
            code.append(i != 0);
            int j = findPositionInTable(code, modecodes);
            if (j >= 0) {
                return j;
            }
        }
        inb.close();
        return -1;
    }