1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| private static BufferedReader open(String pNomFichier) {
File tFile=null;
try {
tFile = new File(pNomFichier);
InputStreamReader tInputSR = new InputStreamReader(new FileInputStream(tFile));
if(Charset.isSupported(tInputSR.getEncoding())){
System.out.println("ça passe!!");
}
cBuffer = new BufferedReader(tInputSR);
tInputSR.close();
} catch (FileNotFoundException eFileNotFoundException) {
//(FileNotFoundException fileNotFoundException)
System.out
.println("Probleme de FileInputStream : FileNotFound");
cBuffer=null;
} catch (IOException eIOException) {
System.out.println("Erreur fermeture InputStreamReader");
} catch(NullPointerException eNullPointerException){
System.out
.println("NullPointer à la création du fichier, chemin sans doute incorrect");
cBuffer=null;
}
return cBuffer;
} |
Partager