}
outputStream.write(content.array(), content.arrayOffset(), content.length());
if (request.size() == request.content().length()) { // start request contains the whole file.
outputStream.close();
File source = new File(shard.blobContainer().getBaseDirectory(), tmpPath);
File target = new File(shard.blobContainer().getBaseDirectory(), request.path());
if (!target.exists()) {
if (!source.renameTo(target)) {
throw new IllegalBlobRecoveryStateException(
"couldn't rename file to " + request.path()