Boolean disableGzipContent = Option.IF_DISABLE_GZIP_CONTENT.getBoolean(options); if (disableGzipContent != null) { insert.setDisableGZipContent(disableGzipContent);
Boolean disableGzipContent = Option.IF_DISABLE_GZIP_CONTENT.getBoolean(options); if (disableGzipContent != null) { insert.setDisableGZipContent(disableGzipContent);
/** * Helper for creating a Storage.Objects.Copy object ready for dispatch given a bucket and object * for an empty object to be created. Caller must already verify that {@code resourceId} * represents a StorageObject and not a bucket. */ private Storage.Objects.Insert prepareEmptyInsert( StorageResourceId resourceId, CreateObjectOptions createObjectOptions) throws IOException { StorageObject object = new StorageObject(); object.setName(resourceId.getObjectName()); Map<String, String> rewrittenMetadata = encodeMetadata(createObjectOptions.getMetadata()); object.setMetadata(rewrittenMetadata); // Ideally we'd use EmptyContent, but Storage requires an AbstractInputStreamContent and not // just an HttpContent, so we'll just use the next easiest thing. ByteArrayContent emptyContent = new ByteArrayContent(createObjectOptions.getContentType(), new byte[0]); Storage.Objects.Insert insertObject = configureRequest( gcs.objects().insert(resourceId.getBucketName(), object, emptyContent), resourceId.getBucketName()); insertObject.setDisableGZipContent(true); clientRequestHelper.setDirectUploadEnabled(insertObject, true); if (resourceId.hasGenerationId()) { insertObject.setIfGenerationMatch(resourceId.getGenerationId()); } else if (!createObjectOptions.overwriteExisting()) { insertObject.setIfGenerationMatch(0L); } return insertObject; }