if (data == null) {
driveItem = service.files().insert(driveItem).execute();
} else {
final InputStreamContent params = new InputStreamContent(FILE, new ByteArrayInputStream(data));
params.setLength(data.length);
Insert inserter = service.files().insert(driveItem, params);
MediaHttpUploader uploader = inserter.getMediaHttpUploader();
prepareUploader(uploader, data);
driveItem = inserter.execute();
}
if (driveItem == null) {
throw new CloudsyncException("Could not create item '" + item.getPath() + "'");
}
_addToCache(driveItem, null);