Java BufferedReader Read All readAllCoursePro()

Here you can find the source of readAllCoursePro()

Description

read All Course Pro

License

Open Source License

Declaration

public synchronized static Vector<String> readAllCoursePro() throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class Main {
    public synchronized static Vector<String> readAllCoursePro() throws IOException {
        File file = new File("D:\\CourseSystemDB\\Course");
        String[] line;/* w ww.  java2  s  . com*/
        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("  ");
            String item = line[0] + "," + line[1] + "," + line[2] + "," + line[3] + "," + line[4] + ",";
            line = reader.readLine().split("  ");
            for (int j = 1; j < line.length - 1; j++) {
                item = item + line[j] + ";";
            }
            item = item + line[line.length - 1] + ",";

            property = reader.readLine();//temporary store course property

            line = reader.readLine().split("  ");
            for (int j = 1; j < line.length - 1; j++) {
                item = item + line[j] + ";";
            }
            item = item + line[line.length - 1] + ",";

            line = property.split("  ");
            item = item + line[1] + " ";
            reader.close();
            allCourse.add(item);
        }

        return allCourse;
    }
}

Related

  1. readAll(String filePathAndName)
  2. readAll(String ip)
  3. readAll(String path)
  4. ReadAll_Variant2(Reader rd, Writer wr)
  5. readAllCourseNum()
  6. readAllCourseTime()
  7. readAllFromInputStream(InputStream inputStream)
  8. readAllFromInputStreamAsList(InputStream inputStream)
  9. ReadAllFromStream(InputStream source)