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 30 31 32 33 34 35 36 37
|
public int[] lecturefichier(File fichiersource) throws IOException{
try {
finst = new FileInputStream(fichiersource);//on connecte un flux de lecture sur le fichier source.
insc = new FileReader(fichiersource);
tab = new int[388];
tba = new String[600];
valeurs = new byte[387*8];
valeurs2Int = new int[387*8];
while(i<=386){
i++;
tab[i]=finst.read();
tba[i]=Integer.toHexString(finst.read());
if(tba[i].equals("ff")) {
finst.read(valeurs, 0, 387*8);
byteToInt(valeurs[i]);
System.out.println(valeurs[i]);
}
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Traitementanimation.class.getName()).log(Level.SEVERE, null, ex);
}return Traitementanimation.tab;
}
public int byteToInt(byte bIn){
if((bIn > 127) || (bIn < -128))
return 0;
else{
if(bIn >= 0)
return (int)bIn;
else{
return (-(-(int)bIn) & 0xff);
}
}
} |
Partager