Creating RequestBody from an InputStream
See original GitHub issueI was looking at RequestBody.java and I can’t find an overload for create() like this:
RequestBody.create(MediaType contentType, InputStream stream)'
Is there a reason not to implement this? This is pretty useful when piping from one stream into an upload job. The overload accepting a File
is useful for files but that’s not the only scenario where buffering in memory does not work.
Please shed some lights if I’m missing something. Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to POST InputStream as the body of a request in Retrofit?
You can upload inputStream using Multipart . @Multipart @POST("pictures") suspend fun uploadPicture( @Part part: MultipartBody.Part ): NetworkPicture.
Read more >RequestBody supports InputStream · Issue #3585 ... - GitHub
I would like to submit a PR to add support for InputStream s in the RequestBody class. As of now, RequestBody supports the...
Read more >InputStreamRequestBody (parent 4.2.0 API)
Creates the @link RequestBody from an @link InputStream . Parameters: mediaType - the media type: inputStream - the input stream ...
Read more >RequestBody (AWS SDK for Java - 2.18.38) - Amazon AWS
Creates a RequestBody from an input stream. "Content-Length" must be provided so that the SDK does not have to make two passes of...
Read more >com.squareup.okhttp.RequestBody.create java code examples
private static RequestBody createRequestBody(Request r) throws AuthFailureError { final byte[] body = r.getBody(); if (body == null) return null; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Course of project , i need the overload , do you find answers?
Handling files on Android is not nice at all, so we need to use content:// URIs. We can get a streams from them, or File Descriptors, but not a file.