class GcpStorageService implements StorageService {

  @Override
  public Blob uploadFileToStorage(URL fileUrl, String fileName) {

    String objectId = generateUniqueObjectId(fileName);
    Blob blobToUpload = createBlob(storageProperties.getTempLocationBucket(), objectId);

    try (BufferedInputStream in = new BufferedInputStream(fileUrl.openStream());
        WriteChannel writer = googleCloudStorage.writer(blobToUpload)) {
      ByteStreams.copy(in, Channels.newOutputStream(writer));

    } catch (IOException e) {
      throw new IngestException(format("Error during upload file (name: %s) from URL: %s "
          + "to cloud storage", fileName, fileUrl), e);
    }

    return googleCloudStorage.get(storageProperties.getTempLocationBucket(), objectId);
  }

}