Refine search
public void fillStreamFromHttpFile(Uri uri) { try { URL url = new URL(uri.getPath()); url.openConnection(); inStream = new BufferedInputStream(url.openStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
private URL getEmbeddedJarUrl(final String embeddedJarPath) throws MalformedURLException { final URL embeddedJarUrl; try { embeddedJarUrl = new URL(this.oneNestedJarUrlBase, embeddedJarPath); } catch (MalformedURLException ex) { // TODO: Notify this to reporters as far as possible. System.err.println("Failed to load entry in embedded JAR: " + embeddedJarPath); ex.printStackTrace(); throw ex; } return embeddedJarUrl; }
public static String getHost(String url) { try { return new URL(url).getHost(); } catch (MalformedURLException e) { e.printStackTrace(); } return url; } }
public static String getDomain(String url) { String domain = ""; try { URL target = new URL(url); domain = target.getHost(); } catch (MalformedURLException e) { log.error("Url(" + url + ") Cannot convert to BASIC-URL"); e.printStackTrace(); } return domain; }
public PreLoad(Context context, String url) { try { this.url = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } uri = URI.create(url); fileUtils = ProxyFileUtils.getInstance(context, uri, false); }
public static String getTopDomain(String url) { String domain = ""; try { URL target = new URL(url); domain = target.getHost(); String[] part = domain.split("\\."); if (part.length > 2) { domain = part[part.length - 3] + "." + part[part.length - 2] + "." + part[part.length - 1]; domain = domain.replace("www.", ""); domain = domain.replace("m.", ""); } } catch (MalformedURLException e) { log.error("Url(" + url + ") Cannot convert to BASIC-URL"); e.printStackTrace(); } return domain; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query GitHub. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the GitHub server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query GitHub. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the GitHub server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query Github. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query GitHub. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the GitHub server. */ public static URL buildUrl(String githubSearchQuery) { Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
/** * Builds the URL used to query GitHub. * * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the GitHub server. */ public static URL buildUrl(String githubSearchQuery) { // COMPLETED (1) Fill in this method to build the proper GitHub query URL Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon() .appendQueryParameter(PARAM_QUERY, githubSearchQuery) .appendQueryParameter(PARAM_SORT, sortBy) .build(); URL url = null; try { url = new URL(builtUri.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } return url; }
public static Bitmap returnBitMap(String url) { URL myFileUrl = null; Bitmap bitmap = null; try { myFileUrl = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) myFileUrl .openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(is); is.close(); } catch (IOException e) { e.printStackTrace(); } return bitmap; }
private List<URL> processNode(List<JsonNode> nodeList) { List<URL> res = new ArrayList<>(); for (JsonNode node : nodeList) { try { for (JsonNode jsonNode : node) { String suffix = jsonNode.get("target").asText(); String path = URLMapper.MAIN_PAGE.toString() + suffix; res.add(new URL(path)); } } catch (MalformedURLException e) { e.printStackTrace(); } } return res; } }
public static Bitmap getBitMap(String url) { URL myFileUrl = null; Bitmap bitmap = null; try { myFileUrl = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) myFileUrl .openConnection(); conn.setRequestProperty("referer", "http://t.qingdaonews.com"); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(is); is.close(); conn.disconnect(); } catch (IOException e) { e.printStackTrace(); } return bitmap; }
URL httpsUrl = new URL( "https", url.getHost(), e.printStackTrace(); logger.log(Level.SEVERE, "Failure creating HTTPS URL", e);