FTP java ÉÏ´« ÏÂÔØ
package com.ftp;
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPFile;
import com.enterprisedt.net.ftp.FTPMessageCollector;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;
import java.io.File;
import java.util.List;
/**
*
*/
public class FtpUtil {
/** ÅжÏÎļþ¼ÐÊÇ·ñ´æÔÚ£¬ÕâÖÖ·½Ê½²»ÊǺÜ×¼ */
public static boolean isDirExist(String dirname, String[] files) {
for (int i = 0; i < files.length; i++) {
if (files[i].indexOf("<DIR>") > -1 && files[i].indexOf(dirname) > -1) {
return true;
}
}
return false;
}
public void upDownFile() {
String host = "10.163.7.15";
String user = "cxl";
String password = "1";
/** ¶¨ÒåFTPClient±ãÀû */
FTPClient ftp = null;
try {
/** ´´½¨FTPClient */
ftp = new FTPClient();
/** Á¬½Ó·þÎñÆ÷ */
ftp.setRemoteHost(host);
ftp.connect();
/** 怫 */
ftp.login(user, password);
/** ÒÔ²¨¶¯Ä£Ê½Á¬½Ó */
ftp.setConnectMode(FTPConnectMode.PASV);
/**
* ASCII·½Ê½£ºÖ»ÄÜ´«ÊäһЩÈçtxtÎı¾Îļþ£¬ zip¡¢jpgµÈÎļþÐèҪʹÓÃBINARY·½Ê½
* */
// ftp.setType(FTPTransferType.ASCII);
ftp.setType(FTPTransferType.BINARY);
/**
* Çл»µ½Ö÷Ŀ¼£¬²¢Ã¶¾ÙÖ÷Ŀ¼µÄËùÓÐÎļþ¼°Îļþ¼Ð °üÀ¨ÈÕÆÚ¡¢Îļþ´óСµÈÏêϸÐÅÏ¢ files = ftp.dir(".")£¬ÔòÖ»ÓÐÎļþÃû
*/
String[] files = ftp.dir(".", true);
for (int i = 0; i < files.length; i++)
System.out.println(files[i]);
/** ÏÂÔØinfoÎļþ¼ÐϵÄËùÓÐÎļþµ½ d:\temp Ŀ¼Ï */
Str
Ïà¹ØÎĵµ£º
2008 Äê 6 ÔÂ 24 ÈÕ
ÔÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄî£¬ËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......
JXL.JAR ²Ù×÷ExcelÎļþ¿ªÔ´°ü
ÕâÀï¼òµ¥½²Ð©ÏîÄ¿ÖÐÓõ½µÄһЩ·½·¨£¡£¨ÏîÄ¿µÄ»·¾³ÊÇStruts2 hibernate3 resin3 £©
// ExcelÎļþ´æ·Å·¾¶
String path = ServletActionContext.getServletContext().getRealPath("")+"userfiles\\train_excel\\text.xls";
// Éú³ÉExcelÎļþ
WritableWorkbook wwb = Workbook.creat ......
ÎļþÉÏ´«·½·¨£¨Ò»´ÎÉÏ´«Ò»¸öÎļþ£¬¶à¸öÎļþµÄ»°£¬Çëдѻ·µ÷Óã©
Upload.uploadFile(theFile, filePath)
˵Ã÷£º
theFile£ºÀàÐÍÊÇFormFile
filePath£ºactionÖз¾¶»ñÈ¡·½·¨ this.getServlet().getServletContext().getRealPath("/")
µ÷Óô˷½·¨·µ»ØÎļþÉÏ´«ºóµÄ·¾¶Ãû
ÉÏ´«¶à¸öÎļþʱ£¬ÇëÉèÖÃÿ¸öÎ ......
×ªÔØµØÖ·£ºhttp://www.javaeye.com/topic/40489
´ÓJDK 1.4¿ªÊ¼£¬JavaµÄ±ê×¼¿âÖоͰüº¬ÁËNIO£¬¼´ËùνµÄ“New IO”¡£ÆäÖÐ×îÖØÒªµÄ¹¦ÄܾÍÊÇÌṩÁË“·Ç×èÈû”µÄIO£¬µ±È»°üÀ¨ÁËSocket¡£NonBlockingµÄIO¾ÍÊǶÔselect(Unixƽ̨ÏÂ)ÒÔ¼° WaitForMultipleObjects(Windowsƽ̨)µÄ·â×°£¬ÌṩÁ˸ßÐÔÄÜ¡¢Ò×ÉìËõµÄ·þÎ ......