title: How to upload multiple files to Google Cloud Storage in a single call using Java API?
body: <p>We want to upload multiple files to Google Cloud Storage. Currently, we are uploading one by one using the Google Java API. The code is below:</p>
  
  <pre><code>public void uploadFile(File srcFile,String bucketName, String destPath) throws IOException {
        BlobId blobId = BlobId.of(bucketName, srcFile.getName());
        BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
  
    long startTime = System.currentTimeMillis();
  
   // Blob blob = storage.create(blobInfo,new FileInputStream(srcFile));
  
    try (WriteChannel writer = storage.writer(blobInfo)) {
      try (FileInputStream in = new FileInputStream(srcFile)){
  
  
          byte[] buffer = new byte[1024 * 1024 * 100] ;
  
          writer.setChunkSize(buffer.length);
  
          int readSize = 0;
  
          while((readSize = in.read(buffer)) &gt; 0) {
               writer.write(ByteBuffer.wrap(buffer, 0, readSize));
          }
  
          long endTime = System.currentTimeMillis();
  
        double writeTime = (double)(endTime - startTime) / 1000;
  
        System.out.println("File write time : " + writeTime);
  
      }
    }
  
  
  }
  </code></pre>
  
  <p>Our application wants to upload multiple files at a time. I tried to find a method to upload multiple files in the Java API, but could not find the any method to upload multiple files using a single call.</p>
  
  <p>If I loop and upload using multiple calls, it is adding a huge network overhead and performance is very slow, which the application cannot afford.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is it possible to upload multiple files via a single call, either using the Java API or REST API?</li>
  <li>Could you please provide an example?</li>
  </ol>