throws CloudException, IOException {
getBlobStore(project).put(blob.data);
BucketData bucket = getBucket(project, bucketName);
DirectoryData dir = getDirectoryData(project, bucket);
DirectoryData.Builder newDir = DirectoryData.newBuilder(dir);
FileData.Builder file = null;
FileData oldFileData;
int foundIndex = findFile(newDir, name);
if (foundIndex != -1) {
oldFileData = dir.getFiles(foundIndex);
file = newDir.getFilesBuilder(foundIndex);
} else {
// We require the file to already exist because otherwise it's
// tricky to set metadata etc.
throw new WebApplicationException(Status.NOT_FOUND);