Commit e42a5d52 by Patryk Czarnik

ObslugaCSV - pierwsza wersja

parent 76703f17
package emps;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class ObslugaCSV {
public static List<Employee> wczytaj(String sciezka) {
List<Employee> emps = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(sciezka))) {
String linia;
while((linia = reader.readLine()) != null) {
String[] t = linia.split(";");
Employee emp = new Employee(Integer.parseInt(t[0]),
t[1], t[2], t[3], Integer.parseInt(t[4]),
LocalDate.parse(t[5]), t[6], t[7], t[8], t[9], t[10]);
emps.add(emp);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return emps;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment