List of utility methods to do URL to
String | convertURL(String url) convert URL String var1 = java.net.URLDecoder.decode(url, "ASCII"); String var2 = var1.replaceAll("%2C", ","); return var2; |
File | convertURLToFile(URL url) convert URL To File if (url == null) { return null; try { return new File(url.toURI()); } catch (URISyntaxException e) { try { return new File(URLDecoder.decode(url.getPath(), "UTF-8")); ... |
String | convertUrlToFilename(URL url) convert Url To Filename return convertUrlToFilename(url.getFile());
|
String | convertUrlToFilePath(URL url) convert Url To File Path try { return URLDecoder.decode(url.getFile(), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); |
String | convertUrlToHostNameAsNodeName(String url) convert Url To Host Name As Node Name String host = new URL(url).getHost().replace('.', '-'); return host; |
File | convertUrlToMp3Cmd(final String url) convert Url To Mp Cmd final String mp3Filename = UUID.randomUUID().toString() + ".mp3"; final String escFilename = URLEncoder.encode(url.substring(url.lastIndexOf("/") + 1), "UTF-8"); final String escUrl = url.substring(0, url.lastIndexOf("/") + 1) + escFilename; final String cmd = "ffmpeg -i " + escUrl + " -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 -af volume=10dB " + mp3Filename; System.out.println(cmd); final Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); ... |
URL | convertURIToURL(URI uri) Tries to convert the specified URI to a URL. try { return uri.toURL(); } catch (MalformedURLException e) { return null; |
void | copyUrlToFile(URL url, File file) copy Url To File final InputStream inputStream; final FileOutputStream fileOutputStream; try { inputStream = url.openStream(); fileOutputStream = new FileOutputStream(file); } catch (final IOException e) { throw new RuntimeException(e); copy(inputStream, fileOutputStream); closeQuietly(inputStream); closeQuietly(fileOutputStream); |
void | copyUrlToFile(URL url, File file) Copies the content of the given url to the specified file. final InputStream inputStream; final FileOutputStream fileOutputStream; try { inputStream = url.openStream(); fileOutputStream = new FileOutputStream(file); } catch (final IOException e) { throw new RuntimeException(e); copy(inputStream, fileOutputStream); closeQuietly(inputStream); closeQuietly(fileOutputStream); |