Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-net-1.4.1.jar - Apache Commons Net
commons-net-1.4.1.jar is the JAR file for Apache Commons Net 1.4.1, which implements the client side of many basic Internet protocols.
commons-net-1.4.1.jar is distributed as part of the commons-net-1.4.1.zip download file.
JAR File Size and Download Location:
JAR name: commons-net.jar, commons-net-1.4.1.jar Target JDK version: 1.4 Dependency: None File name: commons-net-1.4.1.jar File size: 180792 bytes Date modified: 03-Dec-2005 Download: Apache Commons Net
✍: FYIcenter.com
⏎ org/apache/commons/net/ftp/FTPFileList.java
/* * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.net.ftp; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; /** * This class encapsulates a listing of files from an FTP server. It is * initialized with an input stream which is read and the input split into * lines, each of which (after some possible initial verbiage) represents * a file on the FTP server. A parser is also supplied, which is used to * iterate through the internal list of lines parsing each into an FTPFile * object which is returned to the caller of the iteration methods. This * parser may be replaced with another, allowing the same list to be parsed * with different parsers. * Parsing takes place on an as-needed basis, basically, the first time a * position is iterated over. This happens at the time of iteration, not * prior to it as the older <code>(FTPClient.listFiles()</code> methods did, * which required a bigger memory hit. * * @author <a href="mailto:scohen@apache.org">Steve Cohen</a> * @version $Id: FTPFileList.java 165675 2005-05-02 20:09:55Z rwinston $ * @see org.apache.commons.net.ftp.FTPClient#createFileList * @see org.apache.commons.net.ftp.FTPFileIterator * @see org.apache.commons.net.ftp.FTPFileEntryParser * @see org.apache.commons.net.ftp.FTPListParseEngine * @deprecated This class is deprecated as of version 1.2 and will be * removed in version 2.0 -- use FTPFileParseEngine instead. */ public class FTPFileList { /** * storage for the raw lines of input read from the FTP server */ private LinkedList lines = null; /** * the FTPFileEntryParser assigned to be used with this lister */ private FTPFileEntryParser parser; /** * private status code for an empty directory */ private static final int EMPTY_DIR = -2; /** * The only constructor for FTPFileList, private because * construction only invoked at create() * * @param parser a <code>FTPFileEntryParser</code> value that knows * how to parse the entries returned by a particular FTP site. * @param encoding The encoding to use. */ private FTPFileList (FTPFileEntryParser parser, String encoding) { this.parser = parser; this.lines = new LinkedList(); } /** * The only way to create an <code>FTPFileList</code> object. Invokes * the private constructor and then reads the stream supplied stream to * build the intermediate array of "lines" which will later be parsed * into <code>FTPFile</code> object. * * @param stream The input stream created by reading the socket on which * the output of the LIST command was returned * @param parser the default <code>FTPFileEntryParser</code> to be used * by this object. This may later be changed using the init() method. * @param encoding The encoding to use * * @return the <code>FTPFileList</code> created, with an initialized * of unparsed lines of output. Will be null if the listing cannot * be read from the stream. * @exception IOException * Thrown on any failure to read from the socket. */ public static FTPFileList create(InputStream stream, FTPFileEntryParser parser, String encoding) throws IOException { FTPFileList list = new FTPFileList(parser, encoding); list.readStream(stream, encoding); parser.preParse(list.lines); return list; } /** * The only way to create an <code>FTPFileList</code> object. Invokes * the private constructor and then reads the stream supplied stream to * build the intermediate array of "lines" which will later be parsed * into <code>FTPFile</code> object. * * @param stream The input stream created by reading the socket on which * the output of the LIST command was returned * @param parser the default <code>FTPFileEntryParser</code> to be used * by this object. This may later be changed using the init() method. * * @return the <code>FTPFileList</code> created, with an initialized * of unparsed lines of output. Will be null if the listing cannot * be read from the stream. * @exception IOException * Thrown on any failure to read from the socket. * * @deprecated The version of this method which takes an encoding should be used. */ public static FTPFileList create(InputStream stream, FTPFileEntryParser parser) throws IOException { return create(stream, parser, null); } /** * internal method for reading the input into the <code>lines</code> vector. * * @param stream The socket stream on which the input will be read. * @param encoding The encoding to use. * * @exception IOException thrown on any failure to read the stream */ public void readStream(InputStream stream, String encoding) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(stream, encoding)); String line = this.parser.readNextEntry(reader); while (line != null) { this.lines.add(line); line = this.parser.readNextEntry(reader); } reader.close(); } /** * internal method for reading the input into the <code>lines</code> vector. * * @param stream The socket stream on which the input will be read. * * @exception IOException thrown on any failure to read the stream * * @deprecated The version of this method which takes an encoding should be used. */ public void readStream(InputStream stream) throws IOException { readStream(stream, null); } /** * Accessor for this object's default parser. * * @return this object's default parser. */ FTPFileEntryParser getParser() { return this.parser; } /** * Package private accessor for the collection of raw input lines. * * @return vector containing all the raw input lines returned from the FTP * server */ List getLines() { return this.lines; } /** * create an iterator over this list using the parser with which this list * was initally created * * @return an iterator over this list using the list's default parser. */ public FTPFileIterator iterator() { return new FTPFileIterator(this); } /** * create an iterator over this list using the supplied parser * * @param parser The user-supplied parser with which the list is to be * iterated, may be different from this list's default parser. * * @return an iterator over this list using the supplied parser. */ public FTPFileIterator iterator(FTPFileEntryParser parser) { return new FTPFileIterator(this, parser); } /** * returns an array of FTPFile objects for all the files in the directory * listing * * @return an array of FTPFile objects for all the files in the directory * listinge */ public FTPFile[] getFiles() { return iterator().getFiles(); } } /* Emacs configuration * Local variables: ** * mode: java ** * c-basic-offset: 4 ** * indent-tabs-mode: nil ** * End: ** */
⏎ org/apache/commons/net/ftp/FTPFileList.java
Or download all of them as a single archive file:
File name: commons-net-1.4.1-src.zip File size: 324370 bytes Release date: 2013-03-03 Download
⇒ Using commons-net.jar in Java Programs
⇐ What Is commons-net-ftp-2.0.jar
2015-06-03, 75203👍, 0💬
Popular Posts:
How to run "jar" command from JDK tools.jar file? "jar" is the JAR (Java Archive) file management co...
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible...
How to read XML document with XML Schema validation from socket connections with the socket\DelayedI...