Vector lines = new Vector();
BufferedReader reader = null;
String line = null;
try {
FTPFileFactory ff = new FTPFileFactory(parser);
if (locale != null) {
System.out.println("Setting locale to " + locale);
Locale l = new Locale(locale);
Locale[] locales = new Locale[2];
locales[0] = l;
locales[1] = Locale.ENGLISH;
ff.setLocales(locales);
}
else {
Locale[] locales = new Locale[1];
locales[0] = Locale.ENGLISH;
ff.setLocales(locales);
}
reader = new BufferedReader(new FileReader(filename));
while ((line = reader.readLine()) != null) {
lines.addElement(line);
System.out.println(line);
}
String[] listings = new String[lines.size()];
lines.copyInto(listings);
FTPFile[] files = ff.parse(listings);
for (int i = 0; i < files.length; i++)
System.out.println(files[i].toString());
}
catch (IOException ex) {
System.out.println("Failed to read file: " + filename);