private void writeIfChanged(byte[] b, String file) throws IOException {
        File f = new File(file);
        boolean mustWrite = false;
        String event = "[No need to update file ";

        if (force) {
            mustWrite = true;
            event = "[Forcefully writing file ";
        } else {
            if (!f.exists()) {
                mustWrite = true;
                event = "[Creating file ";
            } else {
                int l = (int)f.length();
                if (b.length != l) {
                    mustWrite = true;
                    event = "[Overwriting file ";
                } else {
                    /* Lengths are equal, so read it. */
                    byte[] a = new byte[l];
                    FileInputStream in = new FileInputStream(f);
                    if (in.read(a) != l) {
                        in.close();
                        /* This can't happen, we already checked the length. */
                        Util.error("not.enough.bytes", Integer.toString(l),
                                   f.toString());
                    }
                    in.close();
                    while (--l >= 0) {
                        if (a[l] != b[l]) {
                            mustWrite = true;
                            event = "[Overwriting file ";
                        }
                    }
                }
            }
        }
        if (Util.verbose)
            Util.log(event + file + "]");
        if (mustWrite) {
            OutputStream out = new FileOutputStream(file);
            out.write(b); /* No buffering, just one big write! */
            out.close();
        }
    }