Your question made me curious so I tested some stuff.
What is the exact value of the default chunk length?
I found here that chunkLength is a protected variable of the HttpURLConnection class, meaning it's only accessible inside the class itself or in a subclass. So I made a subclass of HttpURLConnection and tried to print out the 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
return false;
}
@Override
public void connect() throws IOException {
// TODO Auto-generated method stub
}
}
Calling it like this
try {
HttpTest test = new HttpTest(new URL("http://www.google.com/"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
These were the results
![enter image description here]()
From that, we can conclude that the default value it uses is 1024
what is the unit of the parameter?
At the link you posted, it is mentioned that
A small chunk length increases the number of bytes that must be transmitted because of the header on every chunk.
I think it's safe to assume you have to give the number of bytes. The default 1024 also fits that criteria