FSDeltaConsumer fsConsumer = myCurrentRevisionBaton.getConsumer();
fsConsumer.applyText(myCurrentNodeBaton.myPath);
}
public void parseTextBlock(InputStream dumpStream, long contentLength, boolean isDelta) throws SVNException {
FSDeltaConsumer fsConsumer = myCurrentRevisionBaton.getConsumer();
try {
if (isDelta) {
applyTextDelta();
} else {
setFullText();
}
String checksum = null;
byte[] buffer = null;
if (contentLength == 0) {
getDeltaGenerator().sendDelta(myCurrentNodeBaton.myPath, SVNFileUtil.DUMMY_IN, fsConsumer, false);
} else {
if (!isDelta) {
//
InputStream tgt = new FixedSizeInputStream(dumpStream, contentLength);
checksum = getDeltaGenerator().sendDelta(myCurrentNodeBaton.myPath, tgt, fsConsumer, true);
} else {
buffer = new byte[SVNFileUtil.STREAM_CHUNK_SIZE];
SVNDeltaReader deltaReader = null;
try {
while (contentLength > 0) {
int numToRead = contentLength > SVNFileUtil.STREAM_CHUNK_SIZE ? SVNFileUtil.STREAM_CHUNK_SIZE : (int) contentLength;
int read = 0;
while(numToRead > 0) {
int numRead = dumpStream.read(buffer, read, numToRead);
if (numRead < 0) {
SVNAdminHelper.generateIncompleteDataError();
}
read += numRead;
numToRead -= numRead;
}
deltaReader = getDeltaReader();
deltaReader.nextWindow(buffer, 0, read, myCurrentNodeBaton.myPath, fsConsumer);
contentLength -= read;
}
} catch (IOException ioe) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getMessage());
SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
}
if (deltaReader != null) {
deltaReader.reset(myCurrentNodeBaton.myPath, fsConsumer);
}
fsConsumer.textDeltaEnd(myCurrentNodeBaton.myPath);
checksum = fsConsumer.getChecksum();
}
}
if (checksum != null && myCurrentNodeBaton.myResultChecksum != null) {
if (!checksum.equals(myCurrentNodeBaton.myResultChecksum)) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CHECKSUM_MISMATCH, "Checksum mismatch for ''{0}'':\n expected: {1}\n actual: {2}\n",
new Object[] { myCurrentNodeBaton.myPath, myCurrentNodeBaton.myResultChecksum, checksum });
SVNErrorManager.error(err, SVNLogType.FSFS);
}
}
} catch (SVNException svne) {
fsConsumer.abort();
throw svne;
}
}