/*
* ArchivoDispProfesor.java
*
* Created on 10 de noviembre de 2007, 10:57 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package ManejoArchivos;
import GeneracionHorarios.Dia;
import GeneracionHorarios.Profesor;
import ManejoBD.ProfesorBD;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.SQLException;
/**
*
* @author Fernando
*/
public class ArchivoDispProfesor {
private BufferedReader lector;
public ArchivoDispProfesor(String ruta) throws FileNotFoundException{
lector = new BufferedReader(new FileReader(ruta));
}
public Dia leer() throws IOException, SQLException {
String lineaDiaLibre = lector.readLine();
if (lineaDiaLibre==null)
throw new IOException();
String [] datosDiaLibre = lineaDiaLibre.split(",");
Profesor profesor = ProfesorBD.buscarProfesor(datosDiaLibre[0]);
Dia diaLibre = new Dia(datosDiaLibre[1],Integer.parseInt(datosDiaLibre[2])-8,Integer.parseInt(datosDiaLibre[3])-8,true,profesor);
return diaLibre;
}
public void finLectura(){
try {
lector.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}