how can we give user choise of input files for this code

Hi all,

here i am trying to zip one file given by user.

Now i want to convert this code such a way that user can able to give n number of files & after giving inputs user has to get all the input files in ziped formate.

can any body show me the way.

System.out.print("Please enter file name to zip : ");

BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

String filesToZip = input.readLine();

File f = new File(filesToZip);

if(!f.exists()){

System.out.println("File not found.");

System.exit(0);

}

System.out.print("Please enter zip file name : ");

String zipFileName = input.readLine();

if (!zipFileName.endsWith(".zip"))

zipFileName = zipFileName + ".zip";

byte[] buffer = new byte[18024];

try{

ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));

out.setLevel(Deflater.DEFAULT_COMPRESSION);

FileInputStream in = new FileInputStream(filesToZip);

out.putNextEntry(new ZipEntry(filesToZip));

int len;

while ((len = in.read(buffer)) > 0){

out.write(buffer, 0, len);

}

[1181 byte] By [elephant1a] at [2007-11-27 7:30:22]
# 1
use GUI.
j_shadinataa at 2007-7-12 19:10:34 > top of Java-index,Java Essentials,Java Programming...
# 2
A loop around your file name prompt and a convention for ending this loop such as a blank input might help.
quittea at 2007-7-12 19:10:34 > top of Java-index,Java Essentials,Java Programming...