/** Source code example for "A Practical Introduction to Data Structures and Algorithm Analysis, 3rd Edition (Java)" by Clifford A. Shaffer Copyright 2008-2011 by Clifford A. Shaffer */ /** Copy a file's contents to "dum.out". */ import java.io.*; public class Test { static final int NumRec = 1024; public static void main(String args[]) throws IOException { byte[] buf = new byte[4*NumRec]; int[] intbuf = new int[NumRec]; assert args.length == 2 : "Usage: Test \nSize is measured in blocks of 4096 bytes"; int filesize = Integer.parseInt(args[1]); RandomAccessFile in = new RandomAccessFile(args[0], "r"); RandomAccessFile out = new RandomAccessFile("dum.out", "rw"); for (int blocks=0; blocks