@@ -338,6 +338,17 @@ public String open(String signedURL) {
338338 public void write (
339339 String uploadId , byte [] toWrite , int toWriteOffset , long destOffset , int length , boolean last )
340340 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 ) {
341352 // this may have a lot more allocations than ideal, but it'll work.
342353 byte [] bytes ;
343354 if (futureContents .containsKey (uploadId )) {
@@ -352,11 +363,12 @@ public void write(
352363 }
353364 System .arraycopy (toWrite , toWriteOffset , bytes , (int ) destOffset , length );
354365 // we want to mimic the GCS behavior that file contents are only visible on close.
366+ StorageObject storageObject = null ;
355367 if (last ) {
356368 contents .put (uploadId , bytes );
357369 futureContents .remove (uploadId );
358370 if (metadata .containsKey (uploadId )) {
359- StorageObject storageObject = metadata .get (uploadId );
371+ storageObject = metadata .get (uploadId );
360372 Long generation = storageObject .getGeneration ();
361373 if (null == generation ) {
362374 generation = Long .valueOf (0 );
@@ -367,6 +379,7 @@ public void write(
367379 } else {
368380 futureContents .put (uploadId , bytes );
369381 }
382+ return storageObject ;
370383 }
371384
372385 @ Override
0 commit comments