URI: toURL() : URI « java.net « Java by API






URI: toURL()

  

import java.io.File;
import java.io.InputStream;
import java.net.URI;

public class Main {
  public static void main(String[] argv) throws Exception {
    File file = new File("filename");

    URI uri = file.toURI();
    file = new File(uri.toURL().getFile());
    InputStream is = uri.toURL().openStream();
    is.close();
  }
}

   
    
  








Related examples in the same category

1.URI: getAuthority()
2.URI: getFragment()
3.URI: getRawAuthority()
4.URI: getRawFragment()
5.URI: getRawPath()
6.URI: getRawQuery()
7.URI: getRawSchemeSpecificPart()
8.URI: getRawUserInfo()