Java URI Create getURI(File file)

Here you can find the source of getURI(File file)

Description

Return URI for file.

License

Open Source License

Declaration

public static URI getURI(File file) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.net.URI;
import java.net.URISyntaxException;

public class Main {
    /** Return URI for file.
    Replacement for File.toURI() with defined (empty) authority. */
    public static URI getURI(File file) {
        try {//from ww w. j a  va2 s.com
            return new URI("file", "", file.toURI().getPath(), null, null);
        } catch (URISyntaxException e) {
            return null;
        }
    }
}

Related

  1. createURI(String uri)
  2. createURI(String uri)
  3. createURIWithFull(final String scheme, final String userInfo, final String host, final int port, final String path, final String query, final String fragment)
  4. getUri()
  5. getUri(File file)
  6. getUri(File file)
  7. getURI(File file)
  8. getURI(final String address)
  9. getURI(final String base, final String href)