1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import java.io.File;
import java.io.FileNotFoundException;
public class OpenCSV{
private File CSVFile;
public OpenCSV(String path) throws FileNotFoundException {
if (!path.endsWith(".csv")) throw new FileNotFoundException("The file is not a CSV type (Comma Separated Value)");
// on initialise le fichier APRES test sur l'extension
this.CSVFile = new File(path);
if (CSVFile.isDirectory()) throw new FileNotFoundException("The file denoted is a directory, not a file");
if (!CSVFile.exists()) throw new FileNotFoundException("The file does not exists");
}
} |