HttpURLConnections 的 Java 中的范围 属性 是包含的还是排他的?
Is the Range property in Java for HttpURLConnections inclusive or exclusive?
我像这样使用 Range 从网上抓取对象:
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Range", "bytes=0-1000");
// Parallel in different thread
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Range", "bytes=1000-2000");
// More code that actually collects the data
这是在抓第1000字节两次吗?还是上限独占?
职位包括在内。
https://www.rfc-editor.org/rfc/rfc7233#section-2.1
The first-byte-pos value in a byte-range-spec gives the byte-offset of the first byte in a range.
The last-byte-pos value gives the byte-offset of the last byte in the range;
that is, the byte positions specified are inclusive. Byte offsets start at zero.
我像这样使用 Range 从网上抓取对象:
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Range", "bytes=0-1000");
// Parallel in different thread
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Range", "bytes=1000-2000");
// More code that actually collects the data
这是在抓第1000字节两次吗?还是上限独占?
职位包括在内。
https://www.rfc-editor.org/rfc/rfc7233#section-2.1
The first-byte-pos value in a byte-range-spec gives the byte-offset of the first byte in a range. The last-byte-pos value gives the byte-offset of the last byte in the range; that is, the byte positions specified are inclusive. Byte offsets start at zero.