Java Reference
In-Depth Information
}
try
(FileOutputStream
fos
=
new
FileOut-
putStream(args[1]);
ScrambledInputStream sis =
new
ScrambledInputStream(new
FileIn-
putStream(args[0]),
makeMap()))
{
int b;
while ((b = sis.read()) != -1)
fos.write(b);
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
static int[] makeMap()
{
int[] map = new int[256];
for (int i = 0; i < map.length; i++)
map[i] = i;
// Shuffle map.
Random r = new Random(0);
for (int i = 0; i < map.length; i++)
{
int n = r.nextInt(map.length);
int temp = map[i];
map[i] = map[n];
map[n] = temp;
}
int[] temp = new int[256];
for (int i = 0; i < temp.length; i++)
temp[map[i]] = i;
return temp;
Search WWH ::




Custom Search