| 2948 | final Wrapper<Long> result = new Wrapper<Long>(0l); |
| 2949 | ConnectionRequest cr = new GZConnectionRequest() { |
| 2950 | @Override |
| 2951 | protected void readHeaders(Object connection) throws IOException { |
| 2952 | String acceptRanges = getHeader(connection, "Accept-Ranges"); |
| 2953 | if (checkPartialDownloadSupport && (acceptRanges == null || !"bytes".equals(acceptRanges))) { |
| 2954 | // Log.p("The partial downloads of " + url + " are not supported.", Log.WARNING); |
| 2955 | result.set(-2l); |
| 2956 | } else { |
| 2957 | String contentLength = getHeader(connection, "Content-Length"); |
| 2958 | if (contentLength != null) { |
| 2959 | result.set(Long.parseLong(contentLength)); |
| 2960 | } else { |
| 2961 | // Log.p("The Content-Length of " + url + " is unknown.", Log.WARNING); |
| 2962 | result.set(-1l); |
| 2963 | } |
| 2964 | } |
| 2965 | } |
| 2966 | }; |
| 2967 | cr.setUrl(url); |
| 2968 | cr.setHttpMethod("HEAD"); |