public void putRunBits(int i, int len) throws IOException {
        for (int j = len - 1; j >= 0;) {
            if (bits_left != 0 || j < 8) {
                putBit(i);
                j--;
            } else {
                if (i == 0)
                    out.write(0x00);
                else
                    out.write(0xFF);
                j -= 8;
            }
        }
    }