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
| if (o instanceof FICH) {
F = (FICH) o;
try {
fi = F.FIN;
f=new FileInputStream(fi);
fo=new FileOutputStream(fc.c.num);
byte[] buf = new byte[1024];
f.read();
System.out.println("reçu "+fi);
int n;int i=1;
System.out.println("debut d ecriture");
while((n=f.read(buf))==1024){
fo.write(buf,0,n);
System.out.println("ecriture N° "+i);
i++;
}
// //et la on ajoute les bytes plus petits que 1024 ) la fin
fo.write(buf,0,n);
System.out.println("la dernier ecriture");
f.close();
fo.close();
} catch (Exception ex) {
System.out.println(ex + " erreur d ecriture");
ex.printStackTrace();
} |
Partager