Code example for FileNotFoundException

0
	public InputStream getInputStream() throws IOException {
		if (!exists()) {
			throw new FileNotFoundException(getPath() + " (no such file or directory)");
		} 
		if (Files.isDirectory(this.path)) {
			throw new FileNotFoundException(getPath() + " (is a directory)");
		} 
		return Files.newInputStream(this.path);
	} 
 
	/** 
	 * This implementation returns a URL for the underlying file. 
	 * @see java.nio.file.Path#toUri() 
	 * @see java.net.URI#toURL() 
	 */ 
	@Override 
	public URL getURL() throws IOException {
		return this.path.toUri().toURL();
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java