uploadcare / uploadcare-java

Java API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
Apache License 2.0
6 stars 13 forks source link

Upload from InputStream #16

Closed Arteneko closed 5 years ago

Arteneko commented 5 years ago

I'm building a website using Spark, and I receive image files through an input stream.

If possible, I'd like to avoid storing the stream into a file, then using the FileUpload class to upload it, and directly use the InputStream as data source for the image.

dmitry-mukhin commented 5 years ago

this should be able to help, right?

Arteneko commented 5 years ago

By providing the entire image as a byte array ?

The issue I find with that is that I need to load the entire image in memory while uploading, which is not acceptable for a server-side system.

I'll take a look into the apache http lib to see if I can manage to make an edit to have an inputStream as multipart source.

dmitry-mukhin commented 5 years ago

I'm not keen with Java:) But I think it should be easy to overload this constructor and use iterable byte stream (?) instead of bytes array.

dmitry-mukhin commented 5 years ago

closed by #17 and #18

Arteneko commented 5 years ago

Forgot to add myself in the README... Mind doing that ?