Hi Guys,

i have written the following piece of code. and although it compiles and does not throw an exception, when executed. it creates the file for the buffered output stream, but when i open the output file it is empty and no data has been written to it.

Code:
import java.io.*;

public class FileReader{
	public static void main(String[] args) throws Exception{
		String strFrmFile=args[0];
		String strToFile="/Users/me/Desktop/FileReader/"+args[1];

		byte bytBuf[]=new byte[1024];
		int intOfst=0;
		int intBytRd=0;

		BufferedInputStream bis=new BufferedInputStream(new FileInputStream(strFrmFile));
		BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(strToFile));

		intBytRd=bis.read(bytBuf,0,1024);

		while(!(intBytRd<0)){
			bos.write(bytBuf,0,intBytRd);
			intOfst+=intBytRd;

			intBytRd=bis.read(bytBuf,0,1024);
		}

		System.out.println("FileReader: "+strFrmFile+" copied to "+strToFile);
	}
}
admittedly, i thought that i understood what the second argument of the read() and write() methods (i.e. the offset parameters) were for, but now I am not so sure, so i might not be using them correctly. i would be very greatful for any help.


thanks in advance,

- user0182