MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / readHeaders

Method readHeaders

CodenameOne/src/com/codename1/io/Util.java:2950–2965  ·  view source on GitHub ↗
(Object connection)

Source from the content-addressed store, hash-verified

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");

Callers

nothing calls this directly

Calls 4

parseLongMethod · 0.95
equalsMethod · 0.65
setMethod · 0.65
getHeaderMethod · 0.45

Tested by

no test coverage detected