The default block length for Android HttpURLConnection.setChunkedStreamingMode ()?

The HttpURLConnection.setChunkedStreamingMode () documentation says that if I specify 0 in the parameter, it will use the default block length, such as:

conn.setChunkedStreamingMode(0);

What is the exact default block length value? and what is the unit of parameter? in bytes?

+4
source share
1 answer

Your question aroused my curiosity, so I checked some things.

What is the exact default block length value?

, chunkLength HttpURLConnection, , . HttpURLConnection 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

    }
}

try {
    HttpTest test = new HttpTest(new URL("http://www.google.com/"));
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

enter image description here

, 1024


?

, , ,

, - .

, . 1024

+10

All Articles