Flickr4Java icon indicating copy to clipboard operation
Flickr4Java copied to clipboard

Unable to upload large files

Open kipz opened this issue 12 years ago • 5 comments

When uploading large files, a stream is passed to the API:

Flickr.getUploader().upload(InputStream, params)

However, REST.java buffers everything in to a ByteArrayOutputStream before passing it to the scribe OAuth library. Therefore, uploading large files can often cause out of memory errors (depends on the size of file and heap of course).

Scribe OAuth (as far as I know) doesn't support any streaming yet, so we could either create our own implementation, swap out for an implementation that does support this, or ask and wait for those guys to fix theirs.

I've opened an issue on Scribe related to this:

https://github.com/fernandezpablo85/scribe-java/issues/347

kipz avatar Feb 06 '13 22:02 kipz

I forgot to mention, that this currently prevents me from uploading videos (MOVs) over 100MB with a default heap with Oracle JRE 7 on Mac.

kipz avatar Feb 07 '13 11:02 kipz

I don't use Flickr4Java for video (yet) so I've not seen this.

I guess we can see what the Scribe folks say as that would be the best solution I think. If they request a patch is that something you'd consider doing?

boncey avatar Feb 08 '13 15:02 boncey

I'll have a go, but to be honest, doing all that on top of HTTPConnection will be a bit of a bore. Ideally they would integrate Apache HTTP client (or similar) which would give much of it for free.

kipz avatar Feb 08 '13 17:02 kipz

Good point. This pull request looks interesting, wonder if it will get accepted. https://github.com/fernandezpablo85/scribe-java/pull/250

boncey avatar Feb 08 '13 18:02 boncey

Let's hope so, but it's looking pretty quiet over there at the moment...

kipz avatar Feb 08 '13 20:02 kipz