Package ManejoArchivos

Source Code of ManejoArchivos.ArchivoSalon

/*
Clase encargada del manejo del archivo de texto que contiene la información de los salones
en donde se programarán los cursos a ser dictados.
Autor: Fernando Alva
*/


package ManejoArchivos;

import GeneracionHorarios.Salon;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class ArchivoSalon {

    private BufferedReader lector;

    public ArchivoSalon(String ruta) throws FileNotFoundException {
        lector = new BufferedReader(new FileReader(ruta));
    }
   
    public Salon leer(String dia) throws IOException {
        String lineaSalon = lector.readLine();
        if (lineaSalon==null)
            throw new IOException();
        String [] datosSalon = lineaSalon.split(",");
        return new Salon (datosSalon[0],datosSalon[1],Integer.parseInt(datosSalon[2]),dia,Integer.parseInt(datosSalon[3])-8,
                          Integer.parseInt(datosSalon[4])-8);
    }

    public void finLectura() {
        try {
            lector.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}
TOP

Related Classes of ManejoArchivos.ArchivoSalon

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.