• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FTPFileEntryParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.net.ftp.FTPFileEntryParser的典型用法代码示例。如果您正苦于以下问题:Java FTPFileEntryParser类的具体用法?Java FTPFileEntryParser怎么用?Java FTPFileEntryParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FTPFileEntryParser类属于org.apache.commons.net.ftp包,在下文中一共展示了FTPFileEntryParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testParseFTPEntryExpected

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testParseFTPEntryExpected() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  Mar 11 20:56 ADMIN_Documentation");
    assertNotNull(parsed);
    assertEquals(parsed.getType(), FTPFile.DIRECTORY_TYPE);
    assertEquals("user", parsed.getUser());
    assertEquals("ftp", parsed.getGroup());
    assertEquals("ADMIN_Documentation", parsed.getName());

    parsed = parser.parseFTPEntry(
            "drwxr--r--   1 user     group          0 Feb 14 18:14 Downloads");
    assertNotNull(parsed);
    assertEquals("Downloads", parsed.getName());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:20,代码来源:UnixFTPEntryParserTest.java


示例2: testCurrentYear

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testCurrentYear() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1 20708    205             194 Oct 17 14:40 D3I0_805.fixlist");
    assertNotNull(parsed);
    assertTrue(parsed.isFile());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(17, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(14, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY));
    assertEquals(40, parsed.getTimestamp().get(Calendar.MINUTE));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:17,代码来源:UnixFTPEntryParserTest.java


示例3: testLowerCaseMonths

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testLowerCaseMonths() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxrwxrwx    41 spinkb  spinkb      1394 jan 21 20:57 Desktop");
    assertNotNull(parsed);
    assertEquals("Desktop", parsed.getName());
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("spinkb", parsed.getUser());
    assertEquals("spinkb", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.JANUARY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(21, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:18,代码来源:UnixFTPEntryParserTest.java


示例4: testUpperCaseMonths

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testUpperCaseMonths() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxrwxrwx    41 spinkb  spinkb      1394 Feb 21 20:57 Desktop");
    assertNotNull(parsed);
    assertEquals("Desktop", parsed.getName());
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("spinkb", parsed.getUser());
    assertEquals("spinkb", parsed.getGroup());
    assertEquals(Calendar.FEBRUARY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(21, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:17,代码来源:UnixFTPEntryParserTest.java


示例5: testSolarisAcl

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testSolarisAcl() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    //#215
    parsed = parser.parseFTPEntry(
            "drwxrwsr-x+ 34 cristol  molvis      3072 Jul 12 20:16 molvis");
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "molvis");
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("cristol", parsed.getUser());
    assertEquals("molvis", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.JULY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(12, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:19,代码来源:UnixFTPEntryParserTest.java


示例6: testSetuid

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testSetuid() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwsr--r--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwSr--r--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:19,代码来源:UnixFTPEntryParserTest.java


示例7: testSetgid

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testSetgid() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxr-sr--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwxr-Sr--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:19,代码来源:UnixFTPEntryParserTest.java


示例8: testStickyBit

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testStickyBit() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxr--r-t   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwxr--r-T   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:19,代码来源:UnixFTPEntryParserTest.java


示例9: testMVSParser

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testMVSParser() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("MVS is the operating system of this server. FTP Server is running on z/OS.");

    FTPFile parsed;

    final String entry = "drwxr-xr-x   6 START2   SYS1        8192 Oct 28  2008 ADCD";
    parser.preParse(new ArrayList<String>(Arrays.asList("total 66", entry)));
    // #7717
    parsed = parser.parseFTPEntry(entry);
    assertNotNull(parsed);
    assertEquals("ADCD", parsed.getName());
    assertEquals("START2", parsed.getUser());
    assertEquals("SYS1", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(28, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(2008, parsed.getTimestamp().get(Calendar.YEAR));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:20,代码来源:UnixFTPEntryParserTest.java


示例10: testParse8006

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testParse8006() throws Exception {
    final List<String> lines = Arrays.asList(
            "212-Status of /cgi-bin:",
            " drwxr-xr-x   3 1564466  15000           4 Jan 19 19:56 .",
            " drwxr-x---  13 1564466  15000          44 Jun 13 18:36 ..",
            " drwxr-xr-x   2 1564466  15000           2 May 25  2009 tmp",
            " End of status",
            "212 -rw-r--r--   1 1564466  15000        9859 Jan 19 19:56 adoptees.php");
    final FTPFileEntryParser parser = new UnixFTPEntryParser();
    final List<String> list = new FTPStatListService(null, parser).parse(
            212, lines.toArray(new String[lines.size()]));
    assertEquals(6, list.size());
    final Path parent = new Path("/cgi-bin", EnumSet.of(Path.Type.directory));
    final AttributedList<Path> parsed = new FTPListResponseReader(parser, true).read(
            parent, list, new DisabledListProgressListener()
    );
    assertEquals(2, parsed.size());
    assertTrue(parsed.contains(new Path(parent, "tmp", EnumSet.of(Path.Type.directory))));
    assertTrue(parsed.contains(new Path(parent, "adoptees.php", EnumSet.of(Path.Type.file))));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:22,代码来源:FTPStatListServiceTest.java


示例11: testParseEgnyte

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testParseEgnyte() throws Exception {
    final List<String> lines = Arrays.asList(
            "200-drwx------   0 - -            0 Jun 17 07:59 core",
            "200 -rw-------   0 David-Kocher -          529 Jun 17 07:59 App.config");
    final FTPFileEntryParser parser = new LaxUnixFTPEntryParser();
    final List<String> list = new FTPStatListService(null, parser).parse(
            200, lines.toArray(new String[lines.size()]));
    assertEquals(2, list.size());
    assertTrue(list.contains("drwx------   0 - -            0 Jun 17 07:59 core"));
    assertTrue(list.contains("-rw-------   0 David-Kocher -          529 Jun 17 07:59 App.config"));
    final Path parent = new Path("/cyberduck", EnumSet.of(Path.Type.directory));
    final AttributedList<Path> parsed = new FTPListResponseReader(parser, true).read(
            parent, list, new DisabledListProgressListener());
    assertEquals(2, parsed.size());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:17,代码来源:FTPStatListServiceTest.java


示例12: parseFTPEntry

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
public FTPFile parseFTPEntry(String listEntry) {
   if(this.cachedFtpFileEntryParser != null) {
      FTPFile ftpFileEntryParser = this.cachedFtpFileEntryParser.parseFTPEntry(listEntry);
      if(ftpFileEntryParser != null) {
         return ftpFileEntryParser;
      }
   } else {
      FTPFileEntryParser[] var5 = this.ftpFileEntryParsers;
      int var4 = this.ftpFileEntryParsers.length;

      for(int var3 = 0; var3 < var4; ++var3) {
         FTPFileEntryParser var7 = var5[var3];
         FTPFile matched = var7.parseFTPEntry(listEntry);
         if(matched != null) {
            this.cachedFtpFileEntryParser = var7;
            return matched;
         }
      }
   }

   return null;
}
 
开发者ID:Bolt-Thrower,项目名称:xdm,代码行数:23,代码来源:CompositeFileEntryParser.java


示例13: initiateListParsing

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
private FTPListParseEngine initiateListParsing(FTPFileEntryParser parser, String pathname) throws IOException {
   Socket socket = this._openDataConnection_(26, this.getListArguments(pathname));
   FTPListParseEngine engine = new FTPListParseEngine(parser);
   if(socket == null) {
      return engine;
   } else {
      try {
         engine.readServerList(socket.getInputStream(), this.getControlEncoding());
      } finally {
         Util.closeQuietly(socket);
      }

      this.completePendingCommand();
      return engine;
   }
}
 
开发者ID:Bolt-Thrower,项目名称:xdm,代码行数:17,代码来源:FTPClient.java


示例14: CompositeFileEntryParser

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
public CompositeFileEntryParser(FTPFileEntryParser[] ftpFileEntryParsers)
{
    super();

    this.cachedFtpFileEntryParser = null;
    this.ftpFileEntryParsers = ftpFileEntryParsers;
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:8,代码来源:CompositeFileEntryParser.java


示例15: createNTFTPEntryParser

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
/**
 * Creates an NT FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_NT} then a plain {@link org.apache.commons.net.ftp.parser.NTFTPEntryParser} is used,
 * otherwise a composite of {@link org.apache.commons.net.ftp.parser.NTFTPEntryParser} and {@link org.apache.commons.net.ftp.parser.UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config)
{
    if (config != null && FTPClientConfig.SYST_NT.equals(
            config.getServerSystemKey()))
    {
        return new NTFTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
               {
                   new NTFTPEntryParser(config),
                   new UnixFTPEntryParser(config)
               });
    }
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:22,代码来源:DefaultFTPFileEntryParserFactory.java


示例16: createOS400FTPEntryParser

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
/**
 * Creates an OS400 FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_OS400} then a plain {@link org.apache.commons.net.ftp.parser.OS400FTPEntryParser} is used,
 * otherwise a composite of {@link org.apache.commons.net.ftp.parser.OS400FTPEntryParser} and {@link org.apache.commons.net.ftp.parser.UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config)
    {
    if (config != null &&
            FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey()))
    {
        return new OS400FTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
            {
                new OS400FTPEntryParser(config),
                new UnixFTPEntryParser(config)
            });
    }
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:22,代码来源:DefaultFTPFileEntryParserFactory.java


示例17: preParse

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Override
public List<String> preParse(final List<String> original) {
    for(FTPFileEntryParser parser : parsers) {
        parser.preParse(original);
    }
    return original;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:8,代码来源:CompositeFileEntryParser.java


示例18: parseFTPEntry

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Override
public FTPFile parseFTPEntry(final String line) {
    if(log.isDebugEnabled()) {
        log.debug(String.format("Parse %s", line));
    }
    if(current != null) {
        final FTPFile parsed = current.parseFTPEntry(line);
        if(null != parsed) {
            return parsed;
        }
        if(log.isInfoEnabled()) {
            log.info(String.format("Switching parser implementation because %s failed", current));
        }
        current = null;
    }
    for(FTPFileEntryParser parser : parsers) {
        final FTPFile matched = parser.parseFTPEntry(line);
        if(matched != null) {
            current = parser;
            if(log.isInfoEnabled()) {
                log.info(String.format("Caching %s parser implementation", current));
            }
            return matched;
        }
    }
    log.warn(String.format("Failure parsing line %s", line));
    return null;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:29,代码来源:CompositeFileEntryParser.java


示例19: configure

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Override
public void configure(final FTPClientConfig config) {
    for(FTPFileEntryParser parser : parsers) {
        if(parser instanceof Configurable) {
            ((Configurable) parser).configure(config);
        }
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:9,代码来源:CompositeFileEntryParser.java


示例20: testParseTimestamp

import org.apache.commons.net.ftp.FTPFileEntryParser; //导入依赖的package包/类
@Test
public void testParseTimestamp() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  DEC 11 20:56 ADMIN_Documentation");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.DECEMBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(11, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(20, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY));
    assertEquals(56, parsed.getTimestamp().get(Calendar.MINUTE));

    parsed = parser.parseFTPEntry(
            "drwxr-xr-x    3 ftp      ftp           512 Mar 15  2004 doc");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(2004, parsed.getTimestamp().get(Calendar.YEAR));
    assertEquals(Calendar.MARCH, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));

    parsed = parser.parseFTPEntry(
            "drwxrwxr-x    2 ftp      ftp           512 Oct 23  2007 aurox");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(2007, parsed.getTimestamp().get(Calendar.YEAR));
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(23, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:32,代码来源:UnixFTPEntryParserTest.java



注:本文中的org.apache.commons.net.ftp.FTPFileEntryParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Component类代码示例发布时间:2022-05-23
下一篇:
Java Files类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap