List of utility methods to do BufferedReader Read
List | loadToStringListFromFile(String fullFileName) load To String List From File List<String> lines = new ArrayList<String>(); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(fullFileName), "utf-8")); while (true) { String line = br.readLine(); if (line == null) break; ... |
Map[] | loadTrustDistrustSets(String trust_data_set) Read Trust Set and Distrust Set from trust.txt BufferedReader fr = new BufferedReader(new FileReader(trust_data_set)); Map<String, List<String>> usersTNsMap = new HashMap<>(); Map<String, List<String>> usersDTNsMap = new HashMap<>(); String line = null; List<String> tns = null, dtns = null; while ((line = fr.readLine()) != null) { String[] data = line.split(" "); String trustor = data[0]; ... |
Map | loadTrustSet(String trustSet) load Trust Set BufferedReader fr = new BufferedReader(new FileReader(trustSet)); Map<String, Map<String, Double>> userTNsMap = new HashMap<>(); String line = null; Map<String, Double> tns = null; while ((line = fr.readLine()) != null) { if (line.equals("")) continue; String[] data = line.split(" "); ... |
HashMap | loadTwoColumnResource(InputStream resource) Function reads two column file and stores the values into a HashMap HashMap<String, String> result = new HashMap<String, String>(); BufferedReader breader = new BufferedReader(new InputStreamReader(resource)); String line; while ((line = breader.readLine()) != null) { if (line.startsWith("#") || line.matches("^\\s*$")) { continue; String[] fields = line.split("\t"); ... |
String[] | loadTxnDescriptions(String filename) load Txn Descriptions List<String> descriptions = new ArrayList<String>(); FileReader fReader = null; try { fReader = new FileReader(filename); } catch (FileNotFoundException fnfX) { fnfX.printStackTrace(); try { ... |
String[] | loadTXTList(String listFile, int size) load TXT List String[] list = new String[size]; BufferedReader br = new BufferedReader( new InputStreamReader(new GZIPInputStream(new FileInputStream(listFile)))); String line; int count = 0; while (count < size && (line = br.readLine()) != null) { list[count] = line; count++; ... |
String | loadUnicodeStringFromFile(final File file) Load unicode string from file. StringBuffer content = new StringBuffer(); try (final BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(file), "UTF8"))) { final char[] buffer = new char[1 << (3 * 5)]; int read; while ((read = br.read(buffer)) > 0) { content.append(buffer, 0, read); return content.toString(); |
Map | loadVocab(String vocabFilePath, double factor) load Vocab if (factor < 0) factor = 1.0; Map<String, Integer> counts = new LinkedHashMap<>(); try { BufferedReader reader = new BufferedReader(new FileReader(vocabFilePath)); String line; while ((line = reader.readLine()) != null) { if (line.isEmpty()) ... |
Vector | loadWaypoints(File inFile) Given a text file, this method loads a list of waypoints into a vector structure BufferedReader reader = new BufferedReader(new FileReader(inFile)); String line = reader.readLine(); Vector<double[]> locs = new Vector<double[]>(); while (line != null) { line = line.trim(); line = line.replaceAll("\\s+", "\t"); String[] parts = line.trim().split("\\t"); double[] loc = new double[3]; ... |
String | loadXML(String fileName) load XML File mineContents = new File(fileName); BufferedReader reader = new BufferedReader(new FileReader(mineContents)); StringBuffer mineXML = new StringBuffer(); String str; while ((str = reader.readLine()) != null) { mineXML.append(str); reader.close(); ... |