public static ProxyList createProxyList(final String proxies) { if (CommonUtils.isBlank(proxies)) { return new ProxyList(); } final ProxyListEditor editor = new ProxyListEditor(); editor.setAsText(proxies); return (ProxyList) editor.getValue(); }
public void setAsText(final String text) throws IllegalArgumentException { final BufferedReader reader = new BufferedReader(new StringReader(text)); final List<String[]> proxyChains = new ArrayList<String[]>(); try { String line; while ((line = reader.readLine()) != null) { if (CommonUtils.isNotBlank(line)) { proxyChains.add(line.trim().split(" ")); } } } catch (final IOException e) { // ignore this } finally { try { reader.close(); } catch (final IOException e) { // nothing to do } } setValue(new ProxyList(proxyChains)); } }
public void setAsText(final String text) throws IllegalArgumentException { final BufferedReader reader = new BufferedReader(new StringReader(text)); final List proxyChains = new ArrayList(); try { String line; while ((line = reader.readLine()) != null) { if (CommonUtils.isNotBlank(line)) { proxyChains.add(line.trim().split(" ")); } } } catch (final IOException e) { // ignore this } finally { try { reader.close(); } catch (final IOException e) { // nothing to do } } setValue(new ProxyList(proxyChains)); } }
public static ProxyList createProxyList(final String proxies) { if (CommonUtils.isBlank(proxies)) { return new ProxyList(); } final ProxyListEditor editor = new ProxyListEditor(); editor.setAsText(proxies); return (ProxyList) editor.getValue(); }