Source Code Cross Referenced for FTPFileEntryParserImpl.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2005 The Apache Software Foundation
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.apache.commons.net.ftp;
017:
018:        import java.io.BufferedReader;
019:        import java.io.IOException;
020:        import java.io.InputStream;
021:        import java.util.Iterator;
022:        import java.util.List;
023:
024:        /**
025:         * This abstract class implements both the older FTPFileListParser and
026:         * newer FTPFileEntryParser interfaces with default functionality.
027:         * All the classes in the parser subpackage inherit from this.
028:         *
029:         */
030:        public abstract class FTPFileEntryParserImpl implements 
031:                FTPFileEntryParser, FTPFileListParser {
032:            /**
033:             * The constructor for a FTPFileEntryParserImpl object.
034:             */
035:            public FTPFileEntryParserImpl() {
036:            }
037:
038:            /***
039:             * Parses an FTP server file listing and converts it into a usable format
040:             * in the form of an array of <code> FTPFile </code> instances.  If the
041:             * file list contains no files, <code> null </code> should be
042:             * returned, otherwise an array of <code> FTPFile </code> instances
043:             * representing the files in the directory is returned.
044:             * <p>
045:             * @param listStream The InputStream from which the file list should be
046:             *        read.
047:             * @return The list of file information contained in the given path.  null
048:             *     if the list could not be obtained or if there are no files in
049:             *     the directory.
050:             * @exception java.io.IOException  If an I/O error occurs reading the listStream.
051:             ***/
052:            public FTPFile[] parseFileList(InputStream listStream,
053:                    String encoding) throws IOException {
054:                FTPFileList ffl = FTPFileList
055:                        .create(listStream, this , encoding);
056:                return ffl.getFiles();
057:
058:            }
059:
060:            /***
061:             * Parses an FTP server file listing and converts it into a usable format
062:             * in the form of an array of <code> FTPFile </code> instances.  If the
063:             * file list contains no files, <code> null </code> should be
064:             * returned, otherwise an array of <code> FTPFile </code> instances
065:             * representing the files in the directory is returned.
066:             * <p>
067:             * @param listStream The InputStream from which the file list should be
068:             *        read.
069:             * @return The list of file information contained in the given path.  null
070:             *     if the list could not be obtained or if there are no files in
071:             *     the directory.
072:             * @exception java.io.IOException  If an I/O error occurs reading the listStream.
073:             *
074:             * @deprecated The version of this method which takes an encoding should be used.
075:             ***/
076:            public FTPFile[] parseFileList(InputStream listStream)
077:                    throws IOException {
078:                return parseFileList(listStream, null);
079:            }
080:
081:            /**
082:             * Reads the next entry using the supplied BufferedReader object up to
083:             * whatever delemits one entry from the next.  This default implementation
084:             * simply calls BufferedReader.readLine().
085:             *
086:             * @param reader The BufferedReader object from which entries are to be
087:             * read.
088:             *
089:             * @return A string representing the next ftp entry or null if none found.
090:             * @exception java.io.IOException thrown on any IO Error reading from the reader.
091:             */
092:            public String readNextEntry(BufferedReader reader)
093:                    throws IOException {
094:                return reader.readLine();
095:            }
096:
097:            /**
098:             * This method is a hook for those implementors (such as
099:             * VMSVersioningFTPEntryParser, and possibly others) which need to
100:             * perform some action upon the FTPFileList after it has been created
101:             * from the server stream, but before any clients see the list.
102:             *
103:             * This default implementation is a no-op.
104:             *
105:             * @param original Original list after it has been created from the server stream
106:             *
107:             * @return <code>original</code> unmodified.
108:             */
109:            public List preParse(List original) {
110:                Iterator it = original.iterator();
111:                while (it.hasNext()) {
112:                    String entry = (String) it.next();
113:                    if (null == parseFTPEntry(entry)) {
114:                        it.remove();
115:                    } else {
116:                        break;
117:                    }
118:                }
119:                return original;
120:            }
121:        }
122:
123:        /* Emacs configuration
124:         * Local variables:        **
125:         * mode:             java  **
126:         * c-basic-offset:   4     **
127:         * indent-tabs-mode: nil   **
128:         * End:                    **
129:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.