if (myBuffer.remaining() < instructionsLength + newDataLength) {
return;
}
myLastSourceOffset = sourceOffset;
myLastSourceLength = sourceLength;
SVNDiffWindow window = null;
int allDataLength = newDataLength + instructionsLength;
if (myVersion == 1) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int bufferPosition = myBuffer.position();
try {
instructionsLength = deflate(instructionsLength, out);
newDataLength = deflate(newDataLength, out);
} catch (IOException e) {
SVNDebugLog.getDefaultLog().logSevere(SVNLogType.DEFAULT, e);
}
byte[] bytes = out.toByteArray();
ByteBuffer decompressed = ByteBuffer.wrap(bytes);
decompressed.position(0);
window = new SVNDiffWindow(sourceOffset, sourceLength, targetLength, instructionsLength, newDataLength);
window.setData(decompressed);
myBuffer.position(bufferPosition);
} else {
window = new SVNDiffWindow(sourceOffset, sourceLength, targetLength, instructionsLength, newDataLength);
window.setData(myBuffer);
}
int position = myBuffer.position();
OutputStream os = consumer.textDeltaChunk(path, window);
SVNFileUtil.closeFile(os);
myBuffer.position(position + allDataLength);