private static void readCaptchaFile(String fileName) { try { BufferedReader reader = new BufferedReader(new FileReader(new File(fileName))); String line; while ((line = reader.readLine()) != null) captchaList.add(line); reader.close(); } catch (Exception exception) { throw new RuntimeException(exception); } }
static { List<String> spamlist = new ArrayList<String>(); try { BufferedReader reader = new BufferedReader(new FileReader(new File("spamlist.txt"))); String line; while ((line = reader.readLine()) != null) { if (line.trim().isEmpty()) continue; spamlist.add(line); } reader.close(); } catch (Exception exception) { } spamList = spamlist.toArray(new String[0]); }
private static List<String> loadLoginProxies(String fileName) { List<String> proxies = new ArrayList<String>(); try { BufferedReader reader = new BufferedReader(new FileReader(new File(fileName))); String line; while ((line = reader.readLine()) != null) { if (line.trim().isEmpty()) continue; String[] parts = line.split(" ")[0].trim().split(":"); proxies.add(parts[0].trim() + ":" + Integer.parseInt(parts[1].trim())); } reader.close(); } catch (Exception exception) { throw new RuntimeException(exception); } System.out.println("Loaded " + proxies.size() + " login proxies."); return proxies; }
private static List<String> loadAccounts(String fileName) { List<String> accounts = new ArrayList<String>(); try { Pattern pattern = Pattern.compile("[\\w]{1,16}"); BufferedReader reader = new BufferedReader(new FileReader(new File(fileName))); String line; while ((line = reader.readLine()) != null) { Matcher matcher = pattern.matcher(line); if (!matcher.find()) continue; String username = matcher.group(); if (!matcher.find()) continue; String password = matcher.group(); accounts.add(username + ":" + password); } reader.close(); } catch (Exception exception) { throw new RuntimeException(exception); } System.out.println("Loaded " + accounts.size() + " accounts."); return accounts; }
public void run() { try { String line = reader.readLine(); while (shouldRun && line != null) { if (line.length() > 0) { handleChange(line); } else { handleHeartbeat(); } line = reader.readLine(); } String reason = !shouldRun ? "Cancelled" : "EOF"; LOG.info("Changes feed stopped. Reason: " + reason); } catch (Exception e) { handleException(e); } finally { sendInterruptMarker(); httpResponse.abort(); try { reader.close(); } catch (IOException e) { } } }