* @throws IOException
* @throws PatchApplyException
*/
private void apply(File f, FileHeader fh)
throws IOException, PatchApplyException {
RawText rt = new RawText(f);
List<String> oldLines = new ArrayList<String>(rt.size());
for (int i = 0; i < rt.size(); i++)
oldLines.add(rt.getString(i));
List<String> newLines = new ArrayList<String>(oldLines);
for (HunkHeader hh : fh.getHunks()) {
StringBuilder hunk = new StringBuilder();
for (int j = hh.getStartOffset(); j < hh.getEndOffset(); j++)
hunk.append((char) hh.getBuffer()[j]);
RawText hrt = new RawText(hunk.toString().getBytes());
List<String> hunkLines = new ArrayList<String>(hrt.size());
for (int i = 0; i < hrt.size(); i++)
hunkLines.add(hrt.getString(i));
int pos = 0;
for (int j = 1; j < hunkLines.size(); j++) {
String hunkLine = hunkLines.get(j);
switch (hunkLine.charAt(0)) {
case ' ':