protected ArchiveReader getArchiveReader(final URL f, final long offset) throws IOException { // Get URL connection. URLConnection connection = f.openConnection(); if (connection instanceof HttpURLConnection) { addUserAgent((HttpURLConnection)connection); } if (offset != 0) { // Use a Range request (Assumes HTTP 1.1 on other end). If // length >= 0, add open-ended range header to the request. Else, // because end-byte is inclusive, subtract 1. connection.addRequestProperty("Range", "bytes=" + offset + "-"); // TODO: should actually verify that server respected 'Range' request // (spec allows them to ignore; 206 response or Content-Range header // should be present if Range satisfied; multipart/byteranges could be // a problem). } return getArchiveReader(f.toString(), connection.getInputStream(), (offset == 0)); }
protected ArchiveReader getArchiveReader(final URL f, final long offset) throws IOException { // Get URL connection. URLConnection connection = f.openConnection(); if (connection instanceof HttpURLConnection) { addUserAgent((HttpURLConnection)connection); } if (offset != 0) { // Use a Range request (Assumes HTTP 1.1 on other end). If // length >= 0, add open-ended range header to the request. Else, // because end-byte is inclusive, subtract 1. connection.addRequestProperty("Range", "bytes=" + offset + "-"); // TODO: should actually verify that server respected 'Range' request // (spec allows them to ignore; 206 response or Content-Range header // should be present if Range satisfied; multipart/byteranges could be // a problem). } return getArchiveReader(f.toString(), connection.getInputStream(), (offset == 0)); }
protected ArchiveReader getArchiveReader(final URL f, final long offset) throws IOException { // Get URL connection. URLConnection connection = f.openConnection(); if (connection instanceof HttpURLConnection) { addUserAgent((HttpURLConnection)connection); } if (offset != 0) { // Use a Range request (Assumes HTTP 1.1 on other end). If // length >= 0, add open-ended range header to the request. Else, // because end-byte is inclusive, subtract 1. connection.addRequestProperty("Range", "bytes=" + offset + "-"); // TODO: should actually verify that server respected 'Range' request // (spec allows them to ignore; 206 response or Content-Range header // should be present if Range satisfied; multipart/byteranges could be // a problem). } return getArchiveReader(f.toString(), connection.getInputStream(), (offset == 0)); }
".tmp"); addUserAgent((HttpURLConnection)connection); connection.connect(); try {
".tmp"); addUserAgent((HttpURLConnection)connection); connection.connect(); try {
".tmp"); addUserAgent((HttpURLConnection)connection); connection.connect(); try {