⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftplistinputstream.java

📁 用java实现的摄像头编程
💻 JAVA
字号:
/*
 * Version 0.70 01/04/2002
 *
 * Visit my url for update: http://www.geocities.com/beapetrovicova/
 * 
 * jFtp was developed by Bea Petrovicova <beapetrovicova@yahoo.com>.
 * The design and implementation of jFtp are available for royalty-free 
 * adoption and use. This software is provided 'as is' without any 
 * guarantees. Copyright is retained by Bea Petrovicova. Redistribution 
 * of any part of jFtp or any derivative works must include this notice.
 * 
 */
package cz.dhl.ftp;

import java.io.IOException;

/**
 * Allows to list FTP directory.
 * 
 * @Version 0.70 01/04/2002
 * @author Bea Petrovicova <beapetrovicova@yahoo.com> 
 * @author Bea Petrovicova <beapetrovicova@yahoo.com>  
 */
final public class FtpListInputStream extends FtpInputStream 
{
   /** Open 'list' or 'name list' InputStream for given directory.
    * <P><B>LIST</B> - list</P>
    * <P>This command causes a list to be sent from the server to 
    * the passive DTP. If the pathname specifies a directory or 
    * other group of files, the server should transfer a list of 
    * files in the specified directory. If the pathname specifies 
    * a file then the server should send current information on 
    * the file. A null argument implies the user's current working 
    * or default directory. The data transfer is over the data 
    * connection in type ASCII. Since the information on a file 
    * may vary widely from system to system, this information may 
    * be hard to use automatically in a program, but may be quite 
    * useful to a human user.</P>
    * <P><B>NLST</B> - name list</P>
    * <P>This command causes a directory listing to be sent from 
    * server to user site. The pathname should specify a 
    * directory or other system-specific file group descriptor; 
    * a null argument implies the current directory. The server 
    * will return a stream of names of files and no other 
    * information. The data will be transferred in ASCII type 
    * over the data connection as valid pathname strings 
    * separated by [CRLF] or [NL]. This command is intended to 
    * return information that can be used by a program to further 
    * process the files automatically, for example in the 
    * implementation of a "multiple get" function.</P>
    * @param dir directory to be listed
    * @exception IOException socket error
    * @exception FileNotFoundException server directory not found */
   public FtpListInputStream(FtpFile dir) throws IOException 
   {  String command = null;
      if(!dir.client.cd(dir.toString()))
	 throw new IOException("File: cd command failed!\ncd " +dir);
      dir.path = dir.client.pwd();
      data=new FtpDataSocket(dir.client); 
      switch(data.context.getListCommandMode())
      {
      case FtpContext.LIST:
	 command = "LIST"; break;
      case FtpContext.NAME_LIST:
	 command = "NLST"; break;
      case FtpContext.NAME_LIST_LS_F:
	 command = "NLST -F"; break;
      case FtpContext.NAME_LIST_LS_P:
	 command = "NLST -p"; break;
      case FtpContext.NAME_LIST_LS_LA: 
	 command = "NLST -la"; break;
      default: 
         throw new IOException("File: Invalid List Command Mode!");
      }
      stream=data.getInputStream(command/* +dir*/, 'A'); 
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -