@@ -338,6 +338,17 @@ public String open(String signedURL) {
338
338
public void write (
339
339
String uploadId , byte [] toWrite , int toWriteOffset , long destOffset , int length , boolean last )
340
340
throws StorageException {
341
+ writeWithResponse (uploadId , toWrite , toWriteOffset , destOffset , length , last );
342
+ }
343
+
344
+ @ Override
345
+ public StorageObject writeWithResponse (
346
+ String uploadId ,
347
+ byte [] toWrite ,
348
+ int toWriteOffset ,
349
+ long destOffset ,
350
+ int length ,
351
+ boolean last ) {
341
352
// this may have a lot more allocations than ideal, but it'll work.
342
353
byte [] bytes ;
343
354
if (futureContents .containsKey (uploadId )) {
@@ -352,11 +363,12 @@ public void write(
352
363
}
353
364
System .arraycopy (toWrite , toWriteOffset , bytes , (int ) destOffset , length );
354
365
// we want to mimic the GCS behavior that file contents are only visible on close.
366
+ StorageObject storageObject = null ;
355
367
if (last ) {
356
368
contents .put (uploadId , bytes );
357
369
futureContents .remove (uploadId );
358
370
if (metadata .containsKey (uploadId )) {
359
- StorageObject storageObject = metadata .get (uploadId );
371
+ storageObject = metadata .get (uploadId );
360
372
Long generation = storageObject .getGeneration ();
361
373
if (null == generation ) {
362
374
generation = Long .valueOf (0 );
@@ -367,6 +379,7 @@ public void write(
367
379
} else {
368
380
futureContents .put (uploadId , bytes );
369
381
}
382
+ return storageObject ;
370
383
}
371
384
372
385
@ Override
0 commit comments