Example usage for org.apache.commons.net.ftp FTPFileEntryParser preParse

List of usage examples for org.apache.commons.net.ftp FTPFileEntryParser preParse

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPFileEntryParser preParse.

Prototype

List<String> preParse(List<String> original);

Source Link

Document

This method is a hook for those implementors (such as VMSVersioningFTPEntryParser, and possibly others) which need to perform some action upon the FTPFileList after it has been created from the server stream, but before any clients see the list.

Usage

From source file:ch.cyberduck.core.ftp.parser.UnixFTPEntryParserTest.java

@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;//  w w  w .j a v a 2 s  .c  o m

    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));
}