Code example for URI

Methods: getScheme

0
   */ 
  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;
  }