Returns the "version" (aka last modified timestamp) of the URI

@param uri The URI to check the last timestamp

@return The time in ms of the last modification of the URI in String format

@throws IOException
334537
@Override
  public String getVersion(URI uri) throws IOException
  {
    try {
      final S3Coords coords = new S3Coords(checkURI(uri));
      final S3ObjectSummary objectSummary = S3Utils.getSingleObjectSummary(s3Client, coords.bucket, coords.path);
      return StringUtils.format("%d", objectSummary.getLastModified().getTime());
    }
    catch (AmazonServiceException e) {
      if (S3Utils.isServiceExceptionRecoverable(e)) {
        // The recoverable logic is always true for IOException, so we want to only pass IOException if it is recoverable
        throw new IOE(e, "Could not fetch last modified timestamp from URI [%s]", uri);
      } else {
        throw new RE(e, "Error fetching last modified timestamp from URI [%s]", uri);
      }
    }
  }
50217
public String calculateVersionFrom(@NotNull File file){
        Objects.requireNonNull(file, "file argument cannot be null");
        //optimise by store hash against file modified time, on subsequent calls, check file modified time first to determine file and time is present and return previous data.
        final long lastModified = file.lastModified();
        final String key = file.getAbsolutePath() + lastModified;
        final String storedHashValue = fixedSizeCache.get(key);
        if(!StringUtils.isEmpty(storedHashValue)){
            return storedHashValue;
        }
        final String digestHex;
        try {
            digestHex = getHashFromBytes(Files.readAllBytes(file.toPath()));
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        fixedSizeCache.put(key, digestHex);
        return digestHex;
    }
12598
public Long time_GET() throws IOException {
		String qPath = "/auth/time";
		StringBuilder sb = path(qPath);
		String resp = execN(qPath, "GET", sb.toString(), null);
		return convertTo(resp, Long.class);
	}
1364002
public static String getExtension(String uri) {
        if (uri == null) {
            return null;
        }

        int dot = uri.lastIndexOf(".");
        if (dot >= 0) {
            return uri.substring(dot);
        } else {
            // No extension.
            return "";
        }
    }
212373
int version()
  {
    if (_version > 0) {
      return _version;
    }

    CharSegment protocol = getProtocolBuffer();
    if (protocol.equals("HTTP/1.1")) {
      _version = HTTP_1_1;
      return HTTP_1_1;
    }
    else if (protocol.equals("HTTP/1.0")) {
      _version = HTTP_1_0;
      return _version;
    }
    else if (protocol.equals("HTTP/0.9")) {
      _version = HTTP_0_9;
      return HTTP_0_9;
    }
    else if (protocol.length() < 8) {
      _version = HTTP_0_9;
      return _version;
    }

    int i = protocol.indexOf('/');
    int len = protocol.length();
    int major = 0;
    for (i++; i < len; i++) {
      char ch = protocol.charAt(i);

      if ('0' <= ch && ch <= '9')
        major = 10 * major + ch - '0';
      else if (ch == '.')
        break;
      else {
        _version = HTTP_1_0;
        return _version;
      }
    }

    int minor = 0;
    for (i++; i < len; i++) {
      char ch = protocol.charAt(i);

      if ('0' <= ch && ch <= '9')
        minor = 10 * minor + ch - '0';
      else
        break;
    }

    _version = 256 * major + minor;

    return _version;
  }
4057
public String formatKey(URI uri) throws URISyntaxException
	{
		if (uri == null) {
			throw new URISyntaxException("","URI specified is null");
		}
		return formatKey(uri.getHost(), uri.getPort());
	}
117064
public URI getListeningURI() {
    try {
      return new URI(this.serverUri.getScheme(), this.serverUri.getUserInfo(), this.serverUri.getHost(), this.port,
          null, null, null);
    } catch (URISyntaxException use) {
      throw new RuntimeException("Invalid URI. This is an error in code.", use);
    }
  }
43112
public function getVersion($uri)
    {
        $response = $this->guzzleclient->get($uri);
        $data = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }
        return $data;
    }
1267018
private PathEntry getPathEntry(UriEntry uri)
    {
        PathEntry  pathEntry = new PathEntry( ContextRouter.MAP_PATH_TYPE, "default");
        
        
        int length = uri.getLength();
        // like /a or /
        if ( length < 2) return pathEntry;
    

        String requestUri = uri.getRequestUri();
        
        String last_str = uri.get( length - 1 );
        if ( last_str.equals("*") || last_str.equals("") ) {
//            StringBuffer buffer = new StringBuffer();
//            buffer.append('/');
//            
//            for(int i = 0; i < length - 1; i++)
//            {
//                buffer.append(uri.get(i) + "/");
//            }
            
//            position of  last / charactor
            int lastPosition = requestUri.lastIndexOf('/');

            pathEntry.type = ContextRouter.MATCH_PATH_TYPE;
            pathEntry.key  = requestUri.substring(0, lastPosition + 1);
            
            // @TODO maybe we should get parameters to pathEntry
        } else {
            pathEntry.key  = requestUri;
        }
        
        return pathEntry;
    }
57448
public static String getDirName( String uri )
    {
        int lastSlash = uri.lastIndexOf( '/' );
        assert lastSlash != -1 : uri;
        assert uri.length() > 1 : uri;
        assert lastSlash < uri.length() - 1 : "URI must not end with a slash: " + uri;
        return uri.substring( 0, lastSlash );
    }
850417
@Override
  public String getVersion(URI uri) throws IOException
  {
    try {
      return StringUtils.format("%d", buildFileObject(uri, config).getLastModified());
    }
    catch (HdfsIOException ex) {
      throw ex.getIOException();
    }
  }
1286651
public long getModificationTime() {
    if (attributes.containsKey(FILE_MODIFICATION_TIMESTAMP_KEY)
        && attributes.get(FILE_MODIFICATION_TIMESTAMP_KEY) != null) {
      try {
        return Longs.fromByteArray(attributes.get(FILE_MODIFICATION_TIMESTAMP_KEY));
      } catch (IllegalArgumentException iae) {
        logger.atFine().log(
            "Failed to parse modification time '%s' millis for object %s",
            attributes.get(FILE_MODIFICATION_TIMESTAMP_KEY), itemInfo.getObjectName());
      }
    }
    return getCreationTime();
  }
548649
public String getFromRemote(String uri){

        // clear cache
        fileSystem.getFilesCache().close();

        String remoteContent ;
        String remoteEncoding = "utf-8";

        log.debug("getFromRemote: Loading remote URI=" + uri);
        FileContent fileContent ;

        try {

            FileSystemOptions fsOptions = new FileSystemOptions();
            // set userAgent
            HttpFileSystemConfigBuilder.getInstance().setUserAgent(fsOptions, userAgent);

            // set cookie if cookies set
            if (0 < this.cookies.size()) {
                HttpFileSystemConfigBuilder.getInstance().setCookies(fsOptions, getCookies(uri));
            }

            log.debug("getFromRemote: userAgent=" + userAgent);
            log.debug("getFromRemote: cookieSize=" + cookies.size());
            log.debug("getFromRemote: cookies=" + cookies.toString());

            fileContent = fileSystem.resolveFile(uri, fsOptions).getContent();

            // 2016-03-22 only pure http/https auto detect encoding
            if ("http".equalsIgnoreCase(uri.substring(0, 4))) {
                fileContent.getSize();  // pass a bug {@link https://issues.apache.org/jira/browse/VFS-427}
                remoteEncoding = fileContent.getContentInfo().getContentEncoding();
            }

            log.debug("getFromRemote: remoteEncoding=" + remoteEncoding + "(auto detect) ");

            // 2016-03-21 修正zip file getContentEncoding 為null
            if (null == remoteEncoding) remoteEncoding = "utf-8";

            if (!"utf".equalsIgnoreCase(remoteEncoding.substring(0, 3))) {
                log.debug("getFromRemote: remote content encoding=" + remoteEncoding);

                // force charset encoding if setRemoteEncoding set
                if (!"utf".equalsIgnoreCase(encoding.substring(0, 3))) {
                    remoteEncoding = encoding;
                } else {
                    // auto detecting encoding
                    remoteEncoding = detectCharset(IOUtils.toByteArray(fileContent.getInputStream()));
                    log.debug("getFromRemote: real encoding=" + remoteEncoding);
                }
            }

            // 透過  Apache VFS 取回指定的遠端資料
            // 2016-02-29 fixed
            remoteContent = IOUtils.toString(fileContent.getInputStream(), remoteEncoding);

        } catch(FileSystemException fse){
            log.warn("getFromRemote: FileSystemException=" + fse.getMessage());
            remoteContent =null;
        }catch(IOException ioe){
            // return empty
            log.warn("getFromRemote: IOException=" + ioe.getMessage());
            remoteContent =null;
        }catch(StringIndexOutOfBoundsException stre){
            log.warn("getFromRemote: StringIndexOutOfBoundsException=" + stre.getMessage());
            log.warn("getFromRemote: uri=" + uri );
            log.warn(stre.getMessage());
            remoteContent =null;
        }

        clearCookies();

        log.debug("getFromRemote: remoteContent=\n" + remoteContent);
        // any exception will return "null"
        return remoteContent;
    }
929477
public static URI stringAsURI(String s) throws IOException {
    URI u = null;
    // try to make a URI
    try {
      u = new URI(s);
    } catch (URISyntaxException e){
      LOG.error("Syntax error in URI " + s
          + ". Please check hdfs configuration.", e);
    }

    // if URI is null or scheme is undefined, then assume it's file://
    if(u == null || u.getScheme() == null){
      LOG.warn("Path " + s + " should be specified as a URI "
          + "in configuration files. Please update hdfs configuration.");
      u = fileAsURI(new File(s));
    }
    return u;
  }
533558
private static String getVersion(final Class<?> clazz) {
		CodeSource source = clazz.getProtectionDomain().getCodeSource();
		URL location = source.getLocation();

		try {
			Path path = Paths.get(location.toURI());
			return Files.isRegularFile(path) ? getVersionFromJar(path) : getVersionFromPom(path);
		} catch (URISyntaxException ex) {
			Logger.error(ex, "Unknown location: \"{}\"", location);
			return null;
		}
	}
516968
public static String getFormatVersion(File filename) {
		final ContentFileTypeMap map = ensureContentTypeManager();
		return map.getFormatVersion(filename);
	}
684993
public static boolean hasVersionString(String url) {
        boolean inVersion = false;
        for (int i = 0; i < url.length(); i++) {
            char c = url.charAt(i);
            if (c == 'v') {
                inVersion = true;
            } else if (Character.isDigit(c) && inVersion) {
                return true;
            } else {
                inVersion = false;
            }


        }

        return false;
    }