public static void readFileToSet(String type, String filename, Set<String> set) throws IOException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); readFileToSetWithFileInputStream(type, filename, fis, set); }
public static void readFileToMapWithFileInputStream(String type, String filename, InputStream inputStream, Map<String, Integer> map) throws IOException { // The input file could be either simple text or XML. boolean xmlInput = filename.toLowerCase().endsWith(".xml"); if (xmlInput) { readXmlFileToMapWithFileInputStream(type, filename, inputStream, map); } else { HashSet<String> nodes = new HashSet<String>(); readFileToSetWithFileInputStream(type, filename, inputStream, nodes); for (String node : nodes) { map.put(node, null); } } }
@Private public void refresh(InputStream inFileInputStream, InputStream exFileInputStream) throws IOException { LOG.info("Refreshing hosts (include/exclude) list"); HostDetails oldDetails = current.get(); Set<String> newIncludes = oldDetails.includes; Map<String, Integer> newExcludes = oldDetails.excludes; if (inFileInputStream != null) { newIncludes = new HashSet<>(); readFileToSetWithFileInputStream("included", oldDetails.includesFile, inFileInputStream, newIncludes); newIncludes = Collections.unmodifiableSet(newIncludes); } if (exFileInputStream != null) { newExcludes = new HashMap<>(); readFileToMapWithFileInputStream("excluded", oldDetails.excludesFile, exFileInputStream, newExcludes); newExcludes = Collections.unmodifiableMap(newExcludes); } HostDetails newDetails = new HostDetails( oldDetails.includesFile, newIncludes, oldDetails.excludesFile, newExcludes); current.set(newDetails); }
public static void readFileToSet(String type, String filename, Set<String> set) throws IOException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); readFileToSetWithFileInputStream(type, filename, fis, set); }
public static void readFileToSet(String type, String filename, Set<String> set) throws IOException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); readFileToSetWithFileInputStream(type, filename, fis, set); }
public static void readFileToSet(String type, String filename, Set<String> set) throws IOException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); readFileToSetWithFileInputStream(type, filename, fis, set); }
public static void readFileToSet(String type, String filename, Set<String> set) throws IOException { File file = new File(filename); FileInputStream fis = new FileInputStream(file); readFileToSetWithFileInputStream(type, filename, fis, set); }
@Private public synchronized void refresh(InputStream inFileInputStream, InputStream exFileInputStream) throws IOException { LOG.info("Refreshing hosts (include/exclude) list"); Set<String> newIncludes = new HashSet<String>(); Set<String> newExcludes = new HashSet<String>(); boolean switchIncludes = false; boolean switchExcludes = false; if (inFileInputStream != null) { readFileToSetWithFileInputStream("included", includesFile, inFileInputStream, newIncludes); switchIncludes = true; } if (exFileInputStream != null) { readFileToSetWithFileInputStream("excluded", excludesFile, exFileInputStream, newExcludes); switchExcludes = true; } if (switchIncludes) { // switch the new hosts that are to be included includes = newIncludes; } if (switchExcludes) { // switch the excluded hosts excludes = newExcludes; } }
@Private public synchronized void refresh(InputStream inFileInputStream, InputStream exFileInputStream) throws IOException { LOG.info("Refreshing hosts (include/exclude) list"); Set<String> newIncludes = new HashSet<String>(); Set<String> newExcludes = new HashSet<String>(); boolean switchIncludes = false; boolean switchExcludes = false; if (inFileInputStream != null) { readFileToSetWithFileInputStream("included", includesFile, inFileInputStream, newIncludes); switchIncludes = true; } if (exFileInputStream != null) { readFileToSetWithFileInputStream("excluded", excludesFile, exFileInputStream, newExcludes); switchExcludes = true; } if (switchIncludes) { // switch the new hosts that are to be included includes = newIncludes; } if (switchExcludes) { // switch the excluded hosts excludes = newExcludes; } }
boolean switchExcludes = false; if (inFileInputStream != null) { readFileToSetWithFileInputStream("included", includesFile, inFileInputStream, newIncludes); switchIncludes = true; readFileToSetWithFileInputStream("excluded", excludesFile, exFileInputStream, newExcludes); switchExcludes = true;
@Private public synchronized void refresh(InputStream inFileInputStream, InputStream exFileInputStream) throws IOException { LOG.info("Refreshing hosts (include/exclude) list"); Set<String> newIncludes = new HashSet<String>(); Set<String> newExcludes = new HashSet<String>(); boolean switchIncludes = false; boolean switchExcludes = false; if (inFileInputStream != null) { readFileToSetWithFileInputStream("included", includesFile, inFileInputStream, newIncludes); switchIncludes = true; } if (exFileInputStream != null) { readFileToSetWithFileInputStream("excluded", excludesFile, exFileInputStream, newExcludes); switchExcludes = true; } if (switchIncludes) { // switch the new hosts that are to be included includes = newIncludes; } if (switchExcludes) { // switch the excluded hosts excludes = newExcludes; } }