Upload stream with unknown fileSize using Java SDK

  • 1
  • Problem
  • Updated 1 month ago
I am trying to upload an input stream using the apiClient.getUploader as described in the Java API readme. However, as I am trying to upload a stream of unknown size the requestParams.fileSize is set to 0 resulting in the problem described in this post. When the stream is written to file before uploading it works, as stream.available() then return the actual file size, but writing every stream to file before uploading seems unnecessary.  

Is there a way to upload a stream of unknown size using the Java SDK, like the Streamed upload mentioned in the post above, not depending on stream.available() returning the actual file size. Java SDK version is 3.1.5.

From InputStream.available()'s javadoc: 
     * .......It is never correct to use the return value of this method to allocate
     * a buffer intended to hold all data in this stream.

All answers are appreciated :)
Photo of Øystein Molnes

Øystein Molnes

  • 8 Posts
  • 0 Reply Likes

Posted 1 month ago

  • 1

Be the first to post a reply!