class GcpStorageService implements StorageService {

  @Override
  public HttpResponse writeFileToSignedUrlLocation(Blob blob, URL signedUrl) {
    try (ReadChannel reader = googleCloudStorage.reader(blob.getBlobId())) {
      InputStreamContent mediaContent = new InputStreamContent("text/plain",
          new BufferedInputStream(Channels.newInputStream(reader)));
      mediaContent.setLength(blob.getSize());

      HttpResponse response = uploader.resumableUpload(mediaContent, new GenericUrl(signedUrl));
      if (!response.isSuccessStatusCode()) {
        throw new OsduException(format("Not success status of signed url file upload request."
            + " Status: %s%n message: %s", response.getStatusCode(), response.getStatusMessage()));
      }

      return response;
    } catch (IOException e) {
      throw new IngestException(format("Error during upload file: %s from cloud storage to "
          + "signed url location: %s", blob.getBlobId().getName(), signedUrl), e);
    }
  }

}