List of utility methods to do BufferedReader Read All
String | readAll(String path) read All BufferedReader br = new BufferedReader(new FileReader(path)); StringBuilder sb = new StringBuilder(); try { String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); ... |
void | ReadAll_Variant2(Reader rd, Writer wr) Read Al Variant if (rd == null) { throw new Exception("Reader not specified"); if (wr == null) { throw new Exception("Writer not specified"); BufferedReader brd = new BufferedReader(rd); PrintWriter pwr = new PrintWriter(wr); ... |
Vector | readAllCourseNum() read All Course Num File file = new File("D:\\CourseSystemDB\\courseList.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; Vector<String> v = new Vector<String>(); while ((line = reader.readLine()) != null) { String[] temp = line.split(" "); v.addElement(temp[0]); reader.close(); return v; |
Vector | readAllCoursePro() read All Course Pro File file = new File("D:\\CourseSystemDB\\Course"); String[] line; File[] cla = file.listFiles(); Vector<String> allCourse = new Vector<String>(); for (int i = 0; i < cla.length; i++) { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cla[i]))); String property; line = reader.readLine().split(" "); ... |
Vector | readAllCourseTime() read All Course Time File file = new File("D:\\CourseSystemDB\\Course"); String[] cla = file.list(); Vector<String> claTimeList = new Vector<String>(); String[] firstLine; for (int i = 0; i < cla.length; i++) { File claFile = new File("D:\\CourseSystemDB\\Course\\" + cla[i]); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(claFile))); firstLine = reader.readLine().split(" "); ... |
String | readAllFromInputStream(InputStream inputStream) Read all the content from an InputStream instance. BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String result = "", line = ""; while ((line = reader.readLine()) != null) { result += line; return result; |
List | readAllFromInputStreamAsList(InputStream inputStream) read All From Input Stream As List List<String> output; try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { output = new ArrayList<>(); String line; while ((line = reader.readLine()) != null) { output.add(line); return output; |
String | ReadAllFromStream(InputStream source) Read All From Stream StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(source)); String line; while ((line = br.readLine()) != null) { sb.append(line).append("\n"); return sb.toString(); |
String[] | readAllLines(File file) Reads all text of a file and returns the lines as string array. if (file == null || !file.exists()) { throw new IllegalArgumentException("Invalid file given: " + file); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String line = null; List<String> stringBuilder = new ArrayList<String>(); ... |
String[] | readAllLines(File file) read All Lines return readAllLines(new FileInputStream(file)); |