//one block in VMS equals 512 bytes
long longBlock = 512;
if (matches(entry))
{
FTPFile f = new FTPFile();
f.setRawListing(entry);
String name = group(1);
String size = group(2);
String day = group(3);
String mo = group(4);
String yr = group(5);
String hr = group(6);
String min = group(7);
String sec = group(8);
String owner = group(9);
String grp;
String user;
ArrayList list = new ArrayList();
Util.split(list, _matcher_, OWNER_SPLIT_PATTERN, owner);
switch (list.size()) {
case 1:
grp = null;
user = (String)list.get(0);
break;
case 2:
grp = (String)list.get(0);
user = (String)list.get(1);
break;
default:
grp = null;
user = null;
}
if (name.lastIndexOf(".DIR") != -1)
{
f.setType(FTPFile.DIRECTORY_TYPE);
}
else
{
f.setType(FTPFile.FILE_TYPE);
}
//set FTPFile name
//Check also for versions to be returned or not
if (versioning)
{
f.setName(name);
}
else
{
name = name.substring(0, name.lastIndexOf(";"));
f.setName(name);
}
//size is retreived in blocks and needs to be put in bytes
//for us humans and added to the FTPFile array
Long theSize = new Long(size);
long sizeInBytes = theSize.longValue() * longBlock;
f.setSize(sizeInBytes);
//set the date
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.DATE, new Integer(day).intValue());
cal.set(Calendar.MONTH, MONTHS.indexOf(mo) / 4);
cal.set(Calendar.YEAR, new Integer(yr).intValue());
cal.set(Calendar.HOUR_OF_DAY, new Integer(hr).intValue());
cal.set(Calendar.MINUTE, new Integer(min).intValue());
cal.set(Calendar.SECOND, new Integer(sec).intValue());
f.setTimestamp(cal);
f.setGroup(grp);
f.setUser(user);
//set group and owner
//Since I don't need the persmissions on this file (RWED), I'll
//leave that for further development. 'Cause it will be a bit
//elaborate to do it right with VMSes World, Global and so forth.
return f;