List of utility methods to do URI to File Name
java.io.File | getFile(java.net.URI uri) get File if (uri != null) { if (uri.getScheme().equalsIgnoreCase("file")) { return new java.io.File(uri); } else { return null; } else { return null; ... |
File | getFile(String ontURI) Creates a file object for the given local ontology file URI. return new File(new URI(ontURI)); |
String | getFile(String uri) Loads a file from a URI, downloading it. String txt = ""; try { URL oracle = new URL(uri); BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { txt += inputLine + " \n"; in.close(); } catch (Exception e) { return txt; |
File | getFile(URI uri) get File if (uri == null) return null; String proto = uri.toURL().getProtocol(); if (proto == null) { return new File(uri); } else if ("file".equalsIgnoreCase(proto)) String path = uri.toString().replace("file:", ""); ... |
File | getFile(URI uri) Resolves the specified URI, and returns the file represented by the URI. if (uri == null) throw new IllegalArgumentException("The URI cannot be null."); if (!"file".equals(uri.getScheme())) throw new IllegalArgumentException("Wrong URI scheme for path resolution, expected \"file\" " + "and got \"" + uri.getScheme() + "\""); if (uri.getAuthority() != null) try { uri = new URI(uri.toString().replace("file://", "file:/")); ... |
File | getFile(URI uri) Constructs a File instance from a file URI. assert uri != null; File result; final String scheme = uri.getScheme(); if ((scheme == null) || !scheme.toLowerCase(Locale.ROOT).equals("file")) { result = null; } else { try { result = new File(uri); ... |
File | getFileByPathOrURI(String path) get File By Path Or URI path = path.trim(); if (path.startsWith("file://")) { path = path.replace(" ", "%20"); return new File(new URI(path)); } else { return new File(path); |
String | getFileFromURIList(URI[] uris, String fileName) get File From URI List for (URI uri : uris) { if (uri.getPath().endsWith(fileName)) { return uri.getPath(); return null; |
String | getFilename(final URI uri) Returns the filename for the specified URI. if (uri == null) throw new IllegalArgumentException("The URI cannot be null."); final String path = uri.getRawPath(); final int finalSeparator = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\')); if (finalSeparator == -1) throw new IllegalArgumentException("A separator character could not found in the specified URI."); if (finalSeparator == path.length() - 1) throw new IllegalArgumentException("The specified URI does not point to a file resource."); ... |
String | getFilename(final URI uri) Gets the file name of a given URI URL url; if (uri == null) { throw new MalformedURLException("The input URL 'null' is not valid"); url = uri.toURL(); String filePath = url.getFile(); int lastIndex = filePath.lastIndexOf(URL_SEPARATOR); String filenameWithParameters = filePath.substring(lastIndex + 1); ... |