Package IOGenerating

Source Code of IOGenerating.OutputFromFileGenerator

package IOGenerating;

import IOGenerating.Exceptions.InputGeneratingException;
import IOGenerating.Exceptions.OutputGeneratingException;
import Program.Program;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

/**
*
* @author Анна
*/
public class OutputFromFileGenerator extends OutputGenerator {

    private Program program;

    /**
     *
     * @param program
     */
    public OutputFromFileGenerator(Program program) {
        this.program = program;
    }

    /**
     *
     * @param testNumber
     * @return
     */
    public Reader getReader(int testNumber) throws OutputGeneratingException {
        Reader reader = null;
        try {
            reader = new FileReader(program.problem.getPathToTests() + "/" + program.problem.out[testNumber]);
        } catch (FileNotFoundException e) {
            throw new OutputGeneratingException("Test output not found: " + e);
        }
        return reader;
    }
}
TOP

Related Classes of IOGenerating.OutputFromFileGenerator

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.