private static Difference[] parseUnifiedDiff(Reader in) throws IOException {
        BufferedReader br = new BufferedReader(in);
        List<Difference> diffs = new ArrayList<Difference>();
        String line = null;
        do {
            while (line == null || !(line.startsWith(UNIFIED_MARK) &&
                                     line.length() > UNIFIED_MARK.length() &&
                                     line.endsWith(UNIFIED_MARK))) {
                line = br.readLine();
                if (line == null) break;
            }
            if (line == null) continue;
            int[] intervals = new int[4];
            try {
                readUnifiedNums(line, UNIFIED_MARK.length(), intervals);
            } catch (NumberFormatException nfex) {
                IOException ioex = new IOException("Can not parse: " + line);
                ioex.initCause(nfex);
                throw ioex;
            }
            line = fillUnidifChanges(intervals, br, diffs);
        } while (line != null);
        return diffs.toArray(new Difference[diffs.size()]);
    }