@@ -0,0 +1,1105 @@
+import java.io.DataInputStream;%0Aimport java.io.EOFException;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0A%0A%0Apublic class AddNoiseProcess extends MigratableProcess %7B%0A%0A%09private String noise;%0A%09%0A%09public AddNoiseProcess(String args%5B%5D) throws Exception %7B%0A%09%09if (args.length != 3) %7B%0A%09%09%09System.out.println(%22usage: AddNoiseProcess %3CNoise%3E %3CinputFile%3E %3CoutputFile%3E%22);%0A%09%09%09throw new Exception(%22Invalid Arguments%22);%0A%09%09%7D%0A%09%09noise = args%5B0%5D;%0A%09%09inFile = new TransactionalFileInputStream(args%5B1%5D);%0A%09%09outFile = new TransactionalFileOutputStream(args%5B2%5D);%0A%09%7D%0A%09%0A%09@Override%0A%09public void run() %7B%0A%09%09PrintStream out = new PrintStream(outFile);%0A%09%09DataInputStream in = new DataInputStream(inFile);%0A%0A%09%09try %7B%0A%09%09%09while (!suspending) %7B%0A%09%09%09%09String line = in.readLine();%0A%09%09%09%09%0A%09%09%09%09if (line == null)%0A%09%09%09%09%09break;%0A%09%09%09%09%0A%09%09%09%09out.println(line);%0A%09%09%09%09out.println(noise);%0A%09%09%09%09%0A%09%09%09%09try %7B%0A%09%09%09%09%09Thread.sleep(2000);%0A%09%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09%09// ignore it%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D catch (EOFException e) %7B%0A%09%09%09// End of File%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09System.out.println(%22GrepProcess: Error: %22 + e);%0A%09%09%7D%0A%09%09suspending = false;%0A%09%7D%0A%0A%7D%0A

create AddNoise process