}
} else { response.setContentLength((int)len); }
        public PartialContent (HttpServletRequest request, HttpServletResponse response, long len) {            // can only do partial content when length is unkwown            if (len != -1) {                String rangeHeader = request.getHeader(RANGE_HEADER);                if (rangeHeader != null && rangeHeader.startsWith(BYTE_RANGE)) {                    String byteSpec = rangeHeader.substring(BYTE_RANGE.length());                    int sepPos = byteSpec.indexOf('-');                    if (sepPos != -1) {                        if (sepPos > 0) {                            String s = byteSpec.substring(0, sepPos);                            offset = Integer.parseInt(s);                        }                        if (sepPos != byteSpec.length()-1) {                            String s = byteSpec.substring(sepPos + 1);                            endpoint = Integer.parseInt(s);                        } else {                            endpoint = len - 1;                        }                        // notify receiver this is partial content                        response.setStatus(response.SC_PARTIAL_CONTENT);                        String contentRange = offset+"-"+endpoint+"/"+len;                        response.setHeader(CONTENT_RANGE_HEADER, contentRange);                        response.setContentLength((int)(endpoint-offset+1));                        isPartial = true;                    }                }            }        }