/** * read lines. * * @param file file. * @return lines. * @throws IOException */ public static String[] readLines(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return new String[0]; } return readLines(new FileInputStream(file)); }
/** * read lines. * * @param file file. * @return lines. * @throws IOException */ public static String[] readLines(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return new String[0]; } return readLines(new FileInputStream(file)); }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
@Override public void leave(URL url) throws RemotingException { super.leave(url); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); List<String> saves = new ArrayList<String>(); for (String line : lines) { if (full.equals(line)) { return; } saves.add(line); } IOUtils.appendLines(file, saves.toArray(new String[0])); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
@Override public void leave(URL url) throws RemotingException { super.leave(url); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); List<String> saves = new ArrayList<String>(); for (String line : lines) { if (full.equals(line)) { return; } saves.add(line); } IOUtils.appendLines(file, saves.toArray(new String[0])); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
@Override public void leave(URL url) throws RemotingException { super.leave(url); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); List<String> saves = new ArrayList<String>(); for (String line : lines) { if (full.equals(line)) { return; } saves.add(line); } IOUtils.appendLines(file, saves.toArray(new String[0])); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
@Override public void leave(URL url) throws RemotingException { super.leave(url); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); List<String> saves = new ArrayList<String>(); for (String line : lines) { if (full.equals(line)) { return; } saves.add(line); } IOUtils.appendLines(file, saves.toArray(new String[0])); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException { ExchangePeer peer = super.join(url, handler); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); for (String line : lines) { if (full.equals(line)) { return peer; } } IOUtils.appendLines(file, new String[]{full}); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } return peer; }
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException { ExchangePeer peer = super.join(url, handler); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); for (String line : lines) { if (full.equals(line)) { return peer; } } IOUtils.appendLines(file, new String[]{full}); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } return peer; }
@Override public Peer join(URL url, ChannelHandler handler) throws RemotingException { Peer peer = super.join(url, handler); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); for (String line : lines) { if (full.equals(line)) { return peer; } } IOUtils.appendLines(file, new String[]{full}); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } return peer; }
@Override public Peer join(URL url, ChannelHandler handler) throws RemotingException { Peer peer = super.join(url, handler); try { String full = url.toFullString(); String[] lines = IOUtils.readLines(file); for (String line : lines) { if (full.equals(line)) { return peer; } } IOUtils.appendLines(file, new String[]{full}); } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } return peer; }
/** * read lines. * * @param file file. * @return lines. * @throws IOException */ public static String[] readLines(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return new String[0]; } return readLines(new FileInputStream(file)); }
/** * read lines. * * @param file file. * @return lines. * @throws IOException */ public static String[] readLines(File file) throws IOException { if (file == null || !file.exists() || !file.canRead()) { return new String[0]; } return readLines(new FileInputStream(file)); }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }
private void changed() throws RemotingException { try { String[] lines = IOUtils.readLines(file); for (String line : lines) { connect(URL.valueOf(line)); } } catch (IOException e) { throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e); } }