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 38 39
| /*
* Main.java
*
* Created on 8 avril 2007, 15:25
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package packet;
import java.io.*;
/**
*
* @author TVmobile
*/
public static void main(String[] args) throws IOException {
DataInputStream in = new DataInputStream(new FileInputStream("Video1.mpg"));
DataOutputStream out = new DataOutputStream(new FileOutputStream("Video2.mpg"));
while(in.available() > 0){
int b = in.read();
double d = Math.random();
if(d < 0.7)
out.write(b);// j'ai pris 30% comme probabilité d'erreur
else
out.write(0);
}
out.close();
}
} |
Partager