Default chunk length of Android HttpURLConnection.setChunkedStreamingMode()? -



Default chunk length of Android HttpURLConnection.setChunkedStreamingMode()? -

in documentation of httpurlconnection.setchunkedstreamingmode(), said if specify 0 in parameter, utilize default chunk length, such as:

conn.setchunkedstreamingmode(0);

what exact value of default chunk length? , unit of parameter? in bytes?

your question made me curious tested stuff.

what exact value of default chunk length?

i found here chunklength protected variable of httpurlconnection class, meaning it's accessible within class or in subclass. made subclass of httpurlconnection , tried print out chunklength

class httptest extends httpurlconnection { protected httptest(url url) { super(url); log.d("chunklength", string.format("%d", this.chunklength)); this.setchunkedstreamingmode(0); log.d("chunklength", string.format("%d", this.chunklength)); } @override public void disconnect() { // todo auto-generated method stub } @override public boolean usingproxy() { // todo auto-generated method stub homecoming false; } @override public void connect() throws ioexception { // todo auto-generated method stub } }

calling this

try { httptest test = new httptest(new url("http://www.google.com/")); } grab (malformedurlexception e) { // todo auto-generated grab block e.printstacktrace(); }

these results

from that, can conclude default value uses 1024

what unit of parameter?

at link posted, mentioned that

a little chunk length increases the number of bytes must transmitted because of header on every chunk.

i think it's safe assume have give number of bytes. default 1024 fits criteria

android httpurlconnection

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -