Java Path Create nio createUrlQuietly(Path path)

Here you can find the source of createUrlQuietly(Path path)

Description

create Url Quietly

License

Open Source License

Declaration

public static URL createUrlQuietly(Path path) 

Method Source Code

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

import java.net.MalformedURLException;
import java.net.URL;

import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static URL createUrlQuietly(Path path) {
        try {/*from   w  ww. j a v  a 2  s.  com*/
            return path.toUri().toURL();
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }

    public static URL createUrlQuietly(String path) {
        try {
            return Paths.get(path).toUri().toURL();
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. createTempFile(Path baseDir, String prefix, String suffix)
  2. createTempFilePath(final String stem, final String extension)
  3. createTempPath(String prefix, String suffix)
  4. createTmpDir(Path tmpDir, String prefix)
  5. createUniqueFilePath(final String directory, final String baseName, final String suffix)
  6. createZipArchive(final Path sourceDir, final Path destFile)
  7. createZipFile(final File pathToArchive)
  8. createZipFileSystem(Path path)
  9. createZipFileSystem(Path zipFile)