@Override
    public InputStream getInputStream(InputStream is, Metadata metadata, HttpHeaders httpHeaders, UriInfo uriInfo) throws IOException {
        MultivaluedMap params = (uriInfo == null) ? null : uriInfo.getQueryParameters();
        String fetcherName = getParam("fetcherName", httpHeaders, params);
        String fetchKey = getParam("fetchKey", httpHeaders, params);
        fetchKey = urlDecode(fetchKey);
        if (StringUtils.isBlank(fetchKey)) {
            fetchKey = getParam("fetchKeyLiteral", httpHeaders, params);
        }
        ParseContext parseContext = new ParseContext();
        TikaResource.fillParseContext(httpHeaders.getRequestHeaders(), metadata, parseContext);
        long fetchRangeStart = getLong(getParam("fetchRangeStart", httpHeaders, params));
        long fetchRangeEnd = getLong(getParam("fetchRangeEnd", httpHeaders, params));
        if (StringUtils.isBlank(fetcherName) != StringUtils.isBlank(fetchKey)) {
            throw new IOException("Must specify both a 'fetcherName' and a 'fetchKey'. I see: " + " fetcherName:" + fetcherName + " and fetchKey:" + fetchKey);
        }
        if (fetchRangeStart < 0 && fetchRangeEnd > -1) {
            throw new IllegalArgumentException("fetchRangeStart must be > -1 if a fetchRangeEnd " + "is specified");
        }

        if (fetchRangeStart > -1 && fetchRangeEnd < 0) {
            throw new IllegalArgumentException("fetchRangeEnd must be > -1 if a fetchRangeStart " + "is specified");
        }

        if (!StringUtils.isBlank(fetcherName)) {
            try {
                LOG.debug("going to fetch '{}' from fetcher: {}", fetchKey, fetcherName);
                Fetcher fetcher = fetcherManager.getFetcher(fetcherName);
                if (fetchRangeStart > -1 && fetchRangeEnd > -1 && !(fetcher instanceof RangeFetcher)) {
                    throw new IllegalArgumentException(
                            "Can't call a fetch with a range on a fetcher that" + " is not a RangeFetcher: name=" + fetcher.getName() + " class=" + fetcher.getClass());
                }
                return fetcher.fetch(fetchKey, metadata, parseContext);
            } catch (TikaException e) {
                throw new IOException(e);
            }
        }
        return is;
    }
Tries to parse a long out of the value.  If the val is blank, it returns -1.
Throws {@link NumberFormatException}

@param val
@return
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/FetcherStreamFactory.java