當前位置: 首頁>>代碼示例>>Java>>正文


Java FTPFile.setRawListing方法代碼示例

本文整理匯總了Java中org.apache.commons.net.ftp.FTPFile.setRawListing方法的典型用法代碼示例。如果您正苦於以下問題:Java FTPFile.setRawListing方法的具體用法?Java FTPFile.setRawListing怎麽用?Java FTPFile.setRawListing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.net.ftp.FTPFile的用法示例。


在下文中一共展示了FTPFile.setRawListing方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseMemberList

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Parse entries within a partitioned dataset.
 *
 * Format of a memberlist within a PDS: 1 2 3 4 5 6 7 8 9 Name VV.MM Created
 * Changed Size Init Mod Id TBSHELF 01.03 2002/09/12 2002/10/11 09:37 11 11
 * 0 KIL001 TBTOOL 01.12 2002/09/12 2004/11/26 19:54 51 28 0 KIL001
 *
 * ------------------------------------------- [1] Name [2] VV.MM: Version .
 * modification [3] Created: yyyy / MM / dd [4,5] Changed: yyyy / MM / dd
 * HH:mm [6] Size: number of lines [7] Init: number of lines when first
 * created [8] Mod: number of modified lines a last save [9] Id: User id for
 * last update
 *
 *
 * @param file
 *            will be updated with Name, Type and Timestamp if parsed.
 * @param entry zosDirectoryEntry
 * @return true: entry was parsed, false: entry was not parsed.
 */
private boolean parseMemberList(FTPFile file, String entry) {
    if (matches(entry)) {
        file.setRawListing(entry);
        String name = group(1);
        String datestr = group(2) + " " + group(3);
        file.setName(name);
        file.setType(FTPFile.FILE_TYPE);
        try {
            file.setTimestamp(super.parseTimestamp(datestr));
        } catch (ParseException e) {
            e.printStackTrace();
            // just ignore parsing errors.
            // TODO check this is ok
            return false; // this is a parsing failure too.
        }
        return true;
    }

    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:40,代碼來源:MVSFTPEntryParser.java

示例2: parseSimpleEntry

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Assigns the name to the first word of the entry. Only to be used from a
 * safe context, for example from a memberlist, where the regex for some
 * reason fails. Then just assign the name field of FTPFile.
 *
 * @param file
 * @param entry
 * @return true if the entry string is non-null and non-empty
 */
private boolean parseSimpleEntry(FTPFile file, String entry) {
    if (entry != null && entry.trim().length() > 0) {
        file.setRawListing(entry);
        String name = entry.split(" ")[0];
        file.setName(name);
        file.setType(FTPFile.FILE_TYPE);
        return true;
    }
    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:20,代碼來源:MVSFTPEntryParser.java

示例3: parseSimpleEntry

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Assigns the name to the first word of the entry. Only to be used from a
 * safe context, for example from a memberlist, where the regex for some
 * reason fails. Then just assign the name field of FTPFile.
 *
 * @param file
 * @param entry
 * @return
 */
private boolean parseSimpleEntry(FTPFile file, String entry) {
    if (entry != null && entry.trim().length() > 0) {
        file.setRawListing(entry);
        String name = entry.split(" ")[0];
        file.setName(name);
        file.setType(FTPFile.FILE_TYPE);
        return true;
    }
    return false;
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:20,代碼來源:MVSFTPEntryParser.java

示例4: parseFileList

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Parse entries representing a dataset list. Only datasets with DSORG PS or
 * PO or PO-E and with RECFM F* or V* will be parsed.
 *
 * Format of ZOS/MVS file list: 1 2 3 4 5 6 7 8 9 10 Volume Unit Referred
 * Ext Used Recfm Lrecl BlkSz Dsorg Dsname B10142 3390 2006/03/20 2 31 F 80
 * 80 PS MDI.OKL.WORK ARCIVE Not Direct Access Device
 * KJ.IOP998.ERROR.PL.UNITTEST B1N231 3390 2006/03/20 1 15 VB 256 27998 PO
 * PLU B1N231 3390 2006/03/20 1 15 VB 256 27998 PO-E PLB
 *
 * ----------------------------------- Group within Regex [1] Volume [2]
 * Unit [3] Referred [4] Ext: number of extents [5] Used [6] Recfm: Record
 * format [7] Lrecl: Logical record length [8] BlkSz: Block size [9] Dsorg:
 * Dataset organisation. Many exists but only support: PS, PO, PO-E [10]
 * Dsname: Dataset name
 *
 * Note: When volume is ARCIVE, it means the dataset is stored somewhere in
 * a tape archive. These entries is currently not supported by this parser.
 * A null value is returned.
 *
 * @param file
 *            will be updated with Name, Type, Timestamp if parsed.
 * @param entry zosDirectoryEntry
 * @return true: entry was parsed, false: entry was not parsed.
 */
private boolean parseFileList(FTPFile file, String entry) {
    if (matches(entry)) {
        file.setRawListing(entry);
        String name = group(2);
        String dsorg = group(1);
        file.setName(name);

        // DSORG
        if ("PS".equals(dsorg)) {
            file.setType(FTPFile.FILE_TYPE);
        }
        else if ("PO".equals(dsorg) || "PO-E".equals(dsorg)) {
            // regex already ruled out anything other than PO or PO-E
            file.setType(FTPFile.DIRECTORY_TYPE);
        }
        else {
            return false;
        }

        return true;
    }

    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:50,代碼來源:MVSFTPEntryParser.java

示例5: parseFTPEntry

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
     * Parses a line of an NT FTP server file listing and converts it into a
     * usable format in the form of an <code> FTPFile </code> instance.  If the
     * file listing line doesn't describe a file, <code> null </code> is
     * returned, otherwise a <code> FTPFile </code> instance representing the
     * files in the directory is returned.
     * <p>
     * @param entry A line of text from the file listing
     * @return An FTPFile instance corresponding to the supplied entry
     */
//    @Override
    public FTPFile parseFTPEntry(String entry)
    {
        FTPFile f = new FTPFile();
        f.setRawListing(entry);

        if (matches(entry))
        {
            String datestr = group(1)+" "+group(2);
            String dirString = group(3);
            String size = group(4);
            String name = group(5);
            try
            {
                f.setTimestamp(super.parseTimestamp(datestr));
            }
            catch (ParseException e)
            {
                // parsing fails, try the other date format
                try
                {
                    f.setTimestamp(timestampParser.parseTimestamp(datestr));
                }
                catch (ParseException e2)
                {
                    // intentionally do nothing
                }
            }

            if (null == name || name.equals(".") || name.equals(".."))
            {
                return (null);
            }
            f.setName(name);


            if ("<DIR>".equals(dirString))
            {
                f.setType(FTPFile.DIRECTORY_TYPE);
                f.setSize(0);
            }
            else
            {
                f.setType(FTPFile.FILE_TYPE);
                if (null != size)
                {
                  f.setSize(Long.parseLong(size));
                }
            }
            return (f);
        }
        return null;
    }
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:64,代碼來源:NTFTPEntryParser.java

示例6: parseFTPEntry

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Parses a line of an NT FTP server file listing and converts it into a
 * usable format in the form of an <code> FTPFile </code> instance.  If the
 * file listing line doesn't describe a file, <code> null </code> is
 * returned, otherwise a <code> FTPFile </code> instance representing the
 * files in the directory is returned.
 * <p>
 * @param entry A line of text from the file listing
 * @return An FTPFile instance corresponding to the supplied entry
 */
public FTPFile parseFTPEntry(String entry)
{
    FTPFile f = new FTPFile();
    f.setRawListing(entry);

    if (matches(entry))
    {
        String datestr = group(1)+" "+group(2);
        String dirString = group(3);
        String size = group(4);
        String name = group(5);
        try
        {
            f.setTimestamp(super.parseTimestamp(datestr));
        }
        catch (ParseException e)
        {
            // parsing fails, try the other date format
            try
            {
                f.setTimestamp(timestampParser.parseTimestamp(datestr));
            }
            catch (ParseException e2)
            {
                // intentionally do nothing
            }
        }

        if (null == name || name.equals(".") || name.equals(".."))
        {
            return (null);
        }
        f.setName(name);


        if ("<DIR>".equals(dirString))
        {
            f.setType(FTPFile.DIRECTORY_TYPE);
            f.setSize(0);
        }
        else
        {
            f.setType(FTPFile.FILE_TYPE);
            if (null != size)
            {
              f.setSize(Long.parseLong(size));
            }
        }
        return (f);
    }
    return null;
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:63,代碼來源:NTFTPEntryParser.java

示例7: parseJeslevel1List

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Matches these entries, note: no header: [1] [2] [3] [4] [5] IBMUSER1
 * JOB01906 OUTPUT 3 Spool Files
 * 012345678901234567890123456789012345678901234 1 2 3 4
 * ------------------------------------------- Group in regex [1] Job name
 * [2] Job number [3] Job status (INPUT,ACTIVE,OUTPUT) [4] Number of sysout
 * files [5] The string "Spool Files"
 *
 *
 * @param file
 *            will be updated with Name, Type and Timestamp if parsed.
 * @param entry zosDirectoryEntry
 * @return true: entry was parsed, false: entry was not parsed.
 */
private boolean parseJeslevel1List(FTPFile file, String entry) {
    if (matches(entry)) {
        if (group(3).equalsIgnoreCase("OUTPUT")) {
            file.setRawListing(entry);
            String name = group(2); /* Job Number, used by GET */
            file.setName(name);
            file.setType(FTPFile.FILE_TYPE);
            return true;
        }
    }

    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:28,代碼來源:MVSFTPEntryParser.java

示例8: parseJeslevel2List

import org.apache.commons.net.ftp.FTPFile; //導入方法依賴的package包/類
/**
 * Matches these entries, note: no header: [1] [2] [3] [4] [5] JOBNAME JOBID
 * OWNER STATUS CLASS IBMUSER1 JOB01906 IBMUSER OUTPUT A RC=0000 3 spool
 * files IBMUSER TSU01830 IBMUSER OUTPUT TSU ABEND=522 3 spool files
 * 012345678901234567890123456789012345678901234 1 2 3 4
 * ------------------------------------------- Group in regex [1] Job name
 * [2] Job number [3] Owner [4] Job status (INPUT,ACTIVE,OUTPUT) [5] Job
 * Class [6] The rest
 *
 *
 * @param file
 *            will be updated with Name, Type and Timestamp if parsed.
 * @param entry zosDirectoryEntry
 * @return true: entry was parsed, false: entry was not parsed.
 */
private boolean parseJeslevel2List(FTPFile file, String entry) {
    if (matches(entry)) {
        if (group(4).equalsIgnoreCase("OUTPUT")) {
            file.setRawListing(entry);
            String name = group(2); /* Job Number, used by GET */
            file.setName(name);
            file.setType(FTPFile.FILE_TYPE);
            return true;
        }
    }

    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-FileCoreLibrary,代碼行數:29,代碼來源:MVSFTPEntryParser.java


注:本文中的org.apache.commons.net.ftp.FTPFile.setRawListing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。