:: smacks forehead ::

This is why I really shouldn't try to answer questions when I'm
seriously short on sleep.

Anna PS wrote:
> But I get the error on the first line of that code, in the readBytes
> that's called from getBytesFromFile.

Actually, you get it from the ByteArrayOutputStream. It's the one
fragmenting your memory, as it has to keep reallocating its space, 1 KB
at a time.

Change bufferSize to be much bigger, like 1 MB, and see what that gets
you. You're still not going to get much past 5 MB or so, but you might
get past 2 MB.

> To ask a dumb question, as someone who hasn't used chunked uploading
> before: how can I indicate to the server the order in which to glue
> the chunks back together? (Tell me to go away and ask a Java forum if
> you want.)

If you're designing your own protocol, you do it however you want.
You'll need some sort of identifier to indicate that all these PUT
operations are part of the same upload. So, for example, you could send
a final GET request to indicate "we're done uploading" for that identifier.

Jason Proctor wrote:
> what about streaming it with InputStreamEntity?
>
> ideally you'd never have those 2mb cached at one time.

If HttpClient supports streamed HTTP PUT operations, you're right --
this might allow an upload in one step, without chunking. That's
definitely worth a shot and is a great idea!

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.4 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to