List of utility methods to do URL Load
Map | readMappingFile(final URL filename) read Mapping File final Map<String, String> ret = new HashMap<String, String>(); try { BufferedReader in = new BufferedReader(new InputStreamReader(filename.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { String[] retail = inputLine.split("\t"); if (retail.length >= 2) { ret.put(retail[0].trim(), retail[1].trim()); ... |
Optional | readModelFromUrl(URL file, Class read Model From Url try { return Optional.of(GSON.fromJson(new InputStreamReader(file.openStream()), clazz)); } catch (IOException e) { e.printStackTrace(); return Optional.empty(); |
String | readNetFile(String urlstr) read Net File InputStream in = null; try { URL url = new URL(urlstr); in = url.openStream(); String txt = readText(in); return new String(txt.getBytes("ISO-8859-1"), "UTF-8"); } catch (Exception e) { e.printStackTrace(); ... |
String | readPage(final String urlStr) read Page Objects.requireNonNull(urlStr); final StringBuilder builder = new StringBuilder(); Scanner in = null; try { in = new Scanner(new URL(urlStr).openStream()); while (in.hasNextLine()) { builder.append(in.nextLine()); builder.append("\n"); ... |
String | readPage(URL url) Read from a page return readFromInput(url.openStream());
|
Properties | readProperties(final URL url) read Properties Properties listProps = new Properties(); InputStream stream = null; try { stream = url.openStream(); listProps.load(stream); } catch (IOException e) { throw new RuntimeException(e); } finally { ... |
Properties | readProperties(final URL url) Loads and returns a Properties from the passed URL Properties p = new Properties(); InputStream is = null; try { is = url.openStream(); if ("XML".equalsIgnoreCase(getExtension(url))) { p.loadFromXML(is); } else { p.load(is); ... |
Properties | readProperties(URL resource) read Properties Properties properties = new Properties(); InputStream in = null; try { in = resource.openStream(); in = new BufferedInputStream(in); properties.load(in); } finally { try { ... |
Properties | readPropertyFile(URL url) This class reads a properties file and replaces constructs surrounded by ${ and } by a system properties specified within the curly brackets. if (url == null) { throw new IllegalArgumentException("URL must not be null."); try (InputStream inputStream = url.openStream()) { Properties properties = new Properties(); properties.load(inputStream); Pattern pattern = Pattern.compile("\\$\\{([\\w.]+)\\}"); for (Entry<Object, Object> entry : properties.entrySet()) { ... |
List | readResource(final URL filename) read Resource final List<String> ret = new ArrayList<String>(); try { BufferedReader in = new BufferedReader(new InputStreamReader(filename.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) ret.add(inputLine); in.close(); } catch (Exception e) { ... |