sendDelta(path, sourceOffset, source == null ? new byte[0] : source, sourceLength, target, targetLength, consumer);
}
private void sendDelta(String path, long sourceOffset, byte[] source, int sourceLength, byte[] target, int targetLength, ISVNDeltaConsumer consumer) throws SVNException {
// use x or v algorithm depending on sourceLength
SVNDeltaAlgorithm algorithm = sourceLength == 0 ? myVDelta : myXDelta;
algorithm.computeDelta(source, sourceLength, target, targetLength);
// send single diff window to the editor.
if (consumer == null) {
algorithm.reset();
return;
}
int instructionsLength = algorithm.getInstructionsLength();
int newDataLength = algorithm.getNewDataLength();
SVNDiffWindow window = new SVNDiffWindow(sourceOffset, sourceLength, targetLength, instructionsLength, newDataLength);
window.setData(algorithm.getData());
OutputStream os = consumer.textDeltaChunk(path, window);
SVNFileUtil.closeFile(os);
algorithm.reset();
}