Source:
public WritableByteChannel create(final StorageResourceId resourceId, CreateObjectOptions options) throws IOException { logger.atFine().log("create(%s)", resourceId); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); Optional<Long> overwriteGeneration = resourceId.hasGenerationId() ? Optional.of(resourceId.getGenerationId()) : Optional.of(getWriteGeneration(resourceId, options.overwriteExisting())); ObjectWriteConditions writeConditions = new ObjectWriteConditions(overwriteGeneration, Optional.<Long>absent()); Map<String, String> rewrittenMetadata = encodeMetadata(options.getMetadata()); if (storageOptions.isGrpcEnabled()) { Optional<String> requesterPaysProject = requesterShouldPay(resourceId.getBucketName()) ? Optional.of(storageOptions.getRequesterPaysOptions().getProjectId()) : Optional.absent(); GoogleCloudStorageGrpcWriteChannel channel = new GoogleCloudStorageGrpcWriteChannel( backgroundTasksThreadPool, storageStubProvider.getAsyncStub(), resourceId, storageOptions.getWriteChannelOptions(), writeConditions, requesterPaysProject, rewrittenMetadata, options.getContentType()); channel.initialize(); return channel; } GoogleCloudStorageWriteChannel channel = new GoogleCloudStorageWriteChannel( backgroundTasksThreadPool, gcs, clientRequestHelper, resourceId.getBucketName(), resourceId.getObjectName(), options.getContentType(), options.getContentEncoding(), null, storageOptions.getWriteChannelOptions(), writeConditions, rewrittenMetadata) { @Override public Storage.Objects.Insert createRequest(InputStreamContent inputStream) throws IOException { return constructRequest(super.createRequest(inputStream), resourceId.getBucketName()); } }; channel.initialize(); return channel; }

Target:
public WritableByteChannel create(final StorageResourceId resourceId, CreateObjectOptions options) throws IOException { logger.atFine().log("create(%s)", resourceId); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); Optional<Long> writeGeneration = resourceId.hasGenerationId() ? Optional.of(resourceId.getGenerationId()) : Optional.of(getWriteGeneration(resourceId, options.overwriteExisting())); ObjectWriteConditions writeConditions = ObjectWriteConditions.builder() .setContentGenerationMatch(writeGeneration.orElse(null)) .build(); Map<String, String> rewrittenMetadata = encodeMetadata(options.getMetadata()); if (storageOptions.isGrpcEnabled()) { Optional<String> requesterPaysProject = requesterShouldPay(resourceId.getBucketName()) ? Optional.of(storageOptions.getRequesterPaysOptions().getProjectId()) : Optional.empty(); GoogleCloudStorageGrpcWriteChannel channel = new GoogleCloudStorageGrpcWriteChannel( backgroundTasksThreadPool, storageStubProvider.getAsyncStub(), resourceId, storageOptions.getWriteChannelOptions(), writeConditions, requesterPaysProject, rewrittenMetadata, options.getContentType()); channel.initialize(); return channel; } GoogleCloudStorageWriteChannel channel = new GoogleCloudStorageWriteChannel( backgroundTasksThreadPool, gcs, clientRequestHelper, resourceId.getBucketName(), resourceId.getObjectName(), options.getContentType(), options.getContentEncoding(), null, storageOptions.getWriteChannelOptions(), writeConditions, rewrittenMetadata) { @Override public Storage.Objects.Insert createRequest(InputStreamContent inputStream) throws IOException { return initializeRequest(super.createRequest(inputStream), resourceId.getBucketName()); } }; channel.initialize(); return channel; }