public String sendDelta(String path, InputStream source, int sourceOffset, InputStream target, ISVNDeltaConsumer consumer, boolean computeChecksum) throws SVNException { MessageDigest digest = null; if (computeChecksum) { try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage()); SVNErrorManager.error(err, e); return null; } } boolean windowSent = false; while(true) { int targetLength; int sourceLength; try { targetLength = target.read(myTargetBuffer, 0, myTargetBuffer.length); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e); return null; } if (targetLength <= 0) {   if (!windowSent && consumer != null) { consumer.textDeltaChunk(path, SVNDiffWindow.EMPTY); } break; } try { sourceLength = source.read(mySourceBuffer, 0, mySourceBuffer.length); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e); return null; } if (sourceLength < 0) { sourceLength = 0; }  if (digest != null) { digest.update(myTargetBuffer, 0, targetLength); }  sendDelta(path, sourceOffset, mySourceBuffer, sourceLength, myTargetBuffer, targetLength, consumer); windowSent = true; sourceOffset += sourceLength; } if (consumer != null) { consumer.textDeltaEnd(path); } return SVNFileUtil.toHexDigest(digest);
public String sendDelta(String path, InputStream target, ISVNDeltaConsumer consumer, boolean computeChecksum) throws SVNException { return sendDelta(path, SVNFileUtil.DUMMY_IN, 0, target, consumer, computeChecksum);
    public String sendDelta(String path, InputStream source, int sourceOffset, InputStream target, ISVNDeltaConsumer consumer, boolean computeChecksum) throws SVNException {        MessageDigest digest = null;        if (computeChecksum) {            try {                digest = MessageDigest.getInstance("MD5");            } catch (NoSuchAlgorithmException e) {                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage());                SVNErrorManager.error(err, e);                return null;            }        }        boolean windowSent = false;        while(true) {            int targetLength;            int sourceLength;            try {                targetLength = target.read(myTargetBuffer, 0, myTargetBuffer.length);            } catch (IOException e) {                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());                SVNErrorManager.error(err, e);                return null;            }            if (targetLength <= 0) {                // send empty window, needed to create empty file.                 // only when no windows was sent at all.                if (!windowSent && consumer != null) {                    consumer.textDeltaChunk(path, SVNDiffWindow.EMPTY);                }                break;            }             try {                sourceLength = source.read(mySourceBuffer, 0, mySourceBuffer.length);            } catch (IOException e) {                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());                SVNErrorManager.error(err, e);                return null;            }            if (sourceLength < 0) {                sourceLength = 0;            }            // update digest,            if (digest != null) {                digest.update(myTargetBuffer, 0, targetLength);            }            // generate and send window            sendDelta(path, sourceOffset, mySourceBuffer, sourceLength, myTargetBuffer, targetLength, consumer);            windowSent = true;            sourceOffset += sourceLength;        }        if (consumer != null) {            consumer.textDeltaEnd(path);        }        return SVNFileUtil.toHexDigest(digest);    }