1 package ch
.cyberduck
.connection
.sftp
;
4 * ch.cyberduck.connection.ftp.Parser.java
11 * Copyright (c) 2003 David Kocher. All rights reserved.
12 * http://icu.unizh.ch/~dkocher/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * Bug fixes, suggestions and comments should be sent to:
25 * dkocher@cyberduck.ch
29 import java
.io
.IOException
;
31 import com
.sshtools
.j2ssh
.sftp
.SftpFile
;
32 import com
.sshtools
.j2ssh
.sftp
.FileAttributes
;
34 import ch
.cyberduck
.Cyberduck
;
35 import ch
.cyberduck
.Preferences
;
36 import ch
.cyberduck
.connection
.Path
;
37 import ch
.cyberduck
.connection
.Permission
;
39 public class SFTPParser
{
41 private SFTPParser() {
45 public static List
parseList(String parent
, List children
) throws IOException
{
46 // Cyberduck.DEBUG("[FTPParser] parseList(" + parent + "," + list + ")");
47 List parsedList
= new ArrayList();
49 Iterator i
= children
.iterator();
50 boolean showHidden
= Preferences
.instance().getProperty("ftp.showHidden").equals("true");
52 file
= (SftpFile
)i
.next();
53 FileAttributes attributes
= file
.getAttributes();
54 Cyberduck
.DEBUG("***"+file
.getAbsolutePath());
55 // Cyberduck.DEBUG(file.isFile() ? "File" : "Directory");
56 // Cyberduck.DEBUG(" Size:"+attributes.getSize().toString());
57 Cyberduck
.DEBUG(" Permissions:"+attributes
.getPermissions().toString());
58 Path p
= new Path(file
.getAbsolutePath());
59 if(file
.isDirectory())
60 p
.setMode("d---------");
61 //p = new Path(file.getAbsolutePath()+"/");
63 p
.setMode("----------");
64 // p = new Path(file.getAbsolutePath());
65 p
.setSize(attributes
.getSize().intValue());
67 // p.setPermission(attributes.getPermissions().intValue());
68 p
.setModified(attributes
.getModifiedTime().intValue());
69 String filename
= p
.getName();
70 if(!(filename
.equals(".") || filename
.equals(".."))) {
72 if(filename
.charAt(0) == '.') {