private long getWriteGeneration ( StorageResourceId resourceId , boolean overwritable ) throws IOException { logger . atFine ( ) . log ( "getWriteGeneration(%s, %s)" , resourceId , overwritable ) ; GoogleCloudStorageItemInfo info = getItemInfo ( resourceId ) ; if ( ! info . exists ( ) ) { return 0L ; } if ( info . exists ( ) && overwritable ) { long generation = info . getContentGeneration ( ) ; Preconditions . checkState ( generation != 0 , "Generation should not be 0 for an existing item" ) ; return generation ; } throw new FileAlreadyExistsException ( String . format ( "Object %s already exists." , resourceId ) ) ; }
Gets the object generation for a Write operation