Java Doc for FTPFileEntryParser.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » ftp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.ftp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.net.ftp.FTPFileEntryParser

All known Subclasses:   org.apache.commons.net.ftp.FTPFileEntryParserImpl,
FTPFileEntryParser
public interface FTPFileEntryParser (Code)
FTPFileEntryParser defines the interface for parsing a single FTP file listing and converting that information into an org.apache.commons.net.ftp.FTPFile instance. Sometimes you will want to parse unusual listing formats, in which case you would create your own implementation of FTPFileEntryParser and if necessary, subclass FTPFile.

Here are some examples showing how to use one of the classes that implement this interface.

The first example shows how to get an iterable list of files in which the more expensive FTPFile objects are not created until needed. This is suitable for paged displays. It requires that a parser object be created beforehand: parser is an object (in the package org.apache.commons.net.ftp.parser) implementing this inteface.

 FTPClient f=FTPClient();
 f.connect(server);
 f.login(username, password);
 FTPFileList list = f.createFileList(directory, parser);
 FTPFileIterator iter = list.iterator();
 while (iter.hasNext()) {
 FTPFile[] files = iter.getNext(25);  // "page size" you want
 //do whatever you want with these files, display them, etc.
 //expensive FTPFile objects not created until needed.
 }
 
The second example uses the revised FTPClient.listFiles() API to pull the whole list from the subfolder subfolder in one call, attempting to automatically detect the parser type. This method, without a parserKey parameter, indicates that autodection should be used.
 FTPClient f=FTPClient();
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = f.listFiles("subfolder");
 
The third example uses the revised FTPClient.listFiles()> API to pull the whole list from the current working directory in one call, but specifying by classname the parser to be used. For this particular parser class, this approach is necessary since there is no way to autodetect this server type.
 FTPClient f=FTPClient();
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = f.listFiles(
 "org.apache.commons.net.ftp.parser.EnterpriseUnixFTPFileEntryParser",
 ".");
 
The fourth example uses the revised FTPClient.listFiles() API to pull a single file listing in an arbitrary directory in one call, specifying by KEY the parser to be used, in this case, VMS.
 FTPClient f=FTPClient();
 f.connect(server);
 f.login(username, password);
 FTPFile[] files = f.listFiles("VMS", "subfolder/foo.java");
 

author:
   Steve Cohen
version:
   $Id: FTPFileEntryParser.java 165675 2005-05-02 20:09:55Z rwinston $
See Also:   org.apache.commons.net.ftp.FTPFile
See Also:   org.apache.commons.net.ftp.FTPClient.createFileList




Method Summary
 FTPFileparseFTPEntry(String listEntry)
     Parses a line of an FTP server file listing and converts it into a usable format in the form of an FTPFile instance.
 ListpreParse(List original)
     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.
 StringreadNextEntry(BufferedReader reader)
     Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next.



Method Detail
parseFTPEntry
FTPFile parseFTPEntry(String listEntry)(Code)
Parses a line of an FTP server file listing and converts it into a usable format in the form of an FTPFile instance. If the file listing line doesn't describe a file, null should be returned, otherwise a FTPFile instance representing the files in the directory is returned.


Parameters:
  listEntry - A line of text from the file listing An FTPFile instance corresponding to the supplied entry




preParse
List preParse(List original)(Code)
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. The default implementation can be a no-op.
Parameters:
  original - Original list after it has been created from the server stream Original list as processed by this method.



readNextEntry
String readNextEntry(BufferedReader reader) throws IOException(Code)
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next. Implementors must define this for the particular ftp system being parsed. In many but not all cases, this can be defined simply by calling BufferedReader.readLine().
Parameters:
  reader - The BufferedReader object from which entries are to beread. A string representing the next ftp entry or null if none found.
exception:
  IOException - thrown on any IO Error reading from the reader.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.