class AmazonS3URIs {

  public static AmazonS3URI toAmazonS3URI(URI uri) {
    if (FS_PROTOCOL_S3.equalsIgnoreCase(uri.getScheme())) {
      return new AmazonS3URI(uri);
    } else if (S3Schemes.isS3Scheme(uri.getScheme())) {
      try {
        return new AmazonS3URI(new URI(FS_PROTOCOL_S3, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
            uri.getQuery(), uri.getFragment()));
      } catch (URISyntaxException e) {
        // ignore it, it will fail on the return
      }
    }
    // Build it anyway we'll get AmazonS3URI exception back.
    return new AmazonS3URI(uri);
  }

  private  AmazonS3URIs();

}