亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jmyftpclient.java

?? my ftp client basic and easy
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Created on 2005-6-28
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
/**
 * @author CN2WW0D0
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */




import java.io.*;
import java.net.*;
import java.util.*;


public class JMyFtpClient 
{
	
	/**
	 * 
	 */
	public JMyFtpClient() 
	{
		super();
		// TODO Auto-generated constructor stub
		m_FtpClient = null;
	}
	public static void main(String[] args) throws ClassNotFoundException, IOException 
	{
		System.out.println( "JMyFtpClient Started" );
		

		JMyFtpClient ftp = new JMyFtpClient();
		if ( false == ftp.Open( "172.16.64.21" , 21 , "application" , "application" ) )
		{
			System.out.println( "OpenFail" );
			return;
		}

		if ( false == ftp.DownloadDirectory( "/appl/Tmpww" , "C:\\TmpWw\\Down" ) )
			trace( "download Fail" );
/*		if ( false == ftp.UploadDirectory( "C:\\TmpWw" , "/appl/Tmpww") )
			trace( "Uplaod Directpry Fail" );
		else
			trace( "Upload Directory Success" );
*/
/*		for ( int i=0; i < 0; i++ )
		{ 
	
			int nByteDown = ftp.DownloadFile( "appl/3.txt" , "c:\\TmpWw\\Temp\\12" + i + ".txt" );
			if ( nByteDown <= 0 )
				System.out.println( "Download File Fail" );
			else
				trace( "Download File Success" );


			int nByteUp = ftp.UploadFile( "C:\\TmpWw\\1.txt" , "appl/Tmp/Tmp2/1" + i + ".txt" );
			if ( nByteUp <= 0 )
				System.out.println( "Upload File Fail" );
			else
				trace( "Upload File Success" );
		}
*/
		ftp.Close();
		
		System.out.println( "JMyFtpClient Stopped" );
	}
	
	/*Open Connection*/
	public boolean Open( String strServIPAddr , int nServPort , 
							String strUserName , String strPassword )
	{
		try 
		{
			m_FtpClient = new FTPClientDrv( strServIPAddr , nServPort );	//Connect to Server);
	
	
			m_FtpClient.login( strUserName , strPassword );
			
			m_FtpClient.setType(new FTPTransferType());
			
		} 
		catch (IOException e) 
		{
			trace( "Open Ftp Server Fail, IOException" );
			e.printStackTrace();
			return false;
		} catch (FTPException e) 
		{
			trace( "Open Ftp server Fail, Ftp Exception" );
			e.printStackTrace();
			return false;
		}
		trace( "Login FTP Server Ok" );
		return true;
	}
	/**
	 * 	List current wroking directory's content
	 * @param strDir		Root directory
	 */
	public String ListFile( String strDir )
	{
		String strList = strDir;
		try
		{
			strList =  m_FtpClient.list( strList , true );
		}
		catch ( IOException e )
		{
			e.printStackTrace();
			return "";		
		}
		catch ( FTPException e)
		{
			e.printStackTrace();
			return "";
		}
		
		return strList;
	}
	/*
	 * Download File
	 *
	 * */
	public int DownloadFile( String strSrcFile , String strDstFile )
	{
		trace( "Begin Downloading File " + strSrcFile + " to " + strDstFile );
		int nRead = 0;
		int nTmpRead = 0;

		File f = new File( StringTrimHelper.GetPathName(strDstFile) );
		trace( "File Root Path = " + f.getPath() );
		f.mkdirs();
		
		try 
		{
			nRead = m_FtpClient.get( strSrcFile , strDstFile );
			trace( "Download File Length in Bytes = " + nRead );
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
			return -1;
		} 
		catch (FTPException e) 
		{
			e.printStackTrace();
			return -1;
		}
		
		return nRead;
	}
	/*
	 * UploadFile
	 * */
	public int UploadFile( String strSrcFile , String strDstFile )
	{
		int nWrite = 0;
		try
		{
			File f = new File( strSrcFile );
			if ( false == f.exists() )
			{	
				trace( "SourceFile NOT exist! : " + strSrcFile );
				return -1;
			}
			trace( "Current Working Directory =" + m_FtpClient.pwd() );
			String strPathName = StringTrimHelper.GetUrlPathName( strDstFile );
			trace( strPathName );			
			Mkdirs( strPathName );
			nWrite = m_FtpClient.put( strSrcFile , strDstFile );	
			trace( "Upload File Length in Bytes = " + nWrite );		
		}
		catch( IOException e)
		{
			e.printStackTrace();		
			return -1;
		} 
		catch (FTPException e) 
		{
			e.printStackTrace();
			return -1;
		}
		

		return nWrite;
	}
	/**
	 * 
	 * @param strSrcRootPath		source path -local
	 * @param strDstRootPath		dest path	-remote
	 * @return	true for success, false for fail
	 */
	public boolean UploadDirectory( String strSrcRootPath , String strDstRootPath )
	{
		File fSrc = new File( strSrcRootPath );
		if ( false == fSrc.exists() || false == fSrc.isDirectory() )
			return false;
		
		// Remove the remote Dst directory first.
		RemoveDirectory( strDstRootPath , true );
		// Upload file One by One
		String [] astrSrcFile = fSrc.list();
		for ( int i=0; i<astrSrcFile.length; i++ )
		{
			String strSrcFileTmp = strSrcRootPath + "\\" + astrSrcFile[i];
			String strDstFileTmp = strDstRootPath + "/" + astrSrcFile[i];
			File fSrcTmp = new File( strSrcFileTmp );
			if ( fSrcTmp.isDirectory() )
			{
				Mkdirs( strDstFileTmp );
				if ( false == UploadDirectory( strSrcFileTmp , strDstFileTmp ) )
					return false;
				continue;
			}
			if ( fSrcTmp.isFile() )
			{
				if ( UploadFile( strSrcFileTmp , strDstFileTmp ) < 0 )
					return false;
				continue;
			}
			trace( "Error! Unknown File Type : " + strSrcFileTmp + " ; Upload Directory Fail" );
			return false;
		}
		
		
		return true;
	}
	/**
	 * 
	 * @param strSrcRootPath		the remote ftp path
	 * @param strDstRootPath		the local unc path
	 * @return						true for success, false for fail
	 */
	public boolean DownloadDirectory( String strSrcRootPath , String strDstRootPath )
	{
		String [] astrFilePath = null;
		try {
			astrFilePath = m_FtpClient.list( strSrcRootPath );
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		} catch (FTPException e) {
			e.printStackTrace();
			return false;
		}
		//Remove local directory
		if ( strDstRootPath.length() > 3 )	// for case "C:\\" ,never remove system root
			DirectoryHelper.zeroDirectory( strDstRootPath );
		
		for ( int i=1; i<astrFilePath.length; i++ )		//astrFilePath[0] is : "total X"
		{
			String strRawFileInfo = astrFilePath[i].trim();	//trim white space
			String strFilePathTmp = strRawFileInfo.substring(  
											strRawFileInfo.lastIndexOf(" ")+1 , 
											strRawFileInfo.length() );
			if ( 0 == strFilePathTmp.compareToIgnoreCase(".") 
					|| 0 == strFilePathTmp.compareToIgnoreCase("..") )
				continue;

			char chFlag = astrFilePath[i].charAt(0); 
			if ( 'd' == chFlag )
			{	//It is directory
				if ( false == DownloadDirectory( strSrcRootPath + "/" + strFilePathTmp , 
									strDstRootPath + "\\" + strFilePathTmp ) )
					return false;
				continue;
			}
			//Now is file
			if ( 0 > DownloadFile( strSrcRootPath + "/" + strFilePathTmp, strDstRootPath + "\\" + strFilePathTmp ) )
			{
				trace( "Download File Fail: " + strSrcRootPath + "/" + strFilePathTmp);
				return false;
			}
			continue;
		}
		
		return true;
	}
	/**
	 * 
	 * @param strFilePath			the remote file to be del
	 * @return						true for success, false for fail
	 */
	public boolean DeleteFile( String strFilePath )
	{
		try {
			m_FtpClient.delete( strFilePath );
			return true;
		} catch (IOException e) {
			e.printStackTrace();
		} catch (FTPException e) {
			e.printStackTrace();
		}
		return false;
	}
	public boolean RemoveDirectory( String strRootPath , boolean bRmRoot )
	{
		boolean bVal = DeleteDirectory( strRootPath );
		if ( bRmRoot )
		{
			try {
				m_FtpClient.rmdir( strRootPath );
			} catch (IOException e) {
				bVal = false;
			} catch (FTPException e) {
				bVal = false;
			}
		}
		return bVal;
	}
	/**
	 * 
	 * @param strRootPath			the dir to me del
	 * @return						true for success, false for fail
	 */
	private boolean DeleteDirectory( String strRootPath )
	{
		trace( "Begin Del Directory : " + strRootPath );
		String [] astrFilePath = null;
		try {
			astrFilePath = m_FtpClient.list( strRootPath );
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		} catch (FTPException e) {
			e.printStackTrace();
			return false;
		}
		
		for ( int i=1; i<astrFilePath.length; i++ )		//astrFilePath[0] is : "total X"
		{
			String strRawFileInfo = astrFilePath[i].trim();	//trim white space
			String strFilePathTmp = strRawFileInfo.substring(  
											strRawFileInfo.lastIndexOf(" ")+1 , 
											strRawFileInfo.length() );
			if ( 0 == strFilePathTmp.compareToIgnoreCase(".") 
					|| 0 == strFilePathTmp.compareToIgnoreCase("..") )
				continue;

			char chFlag = astrFilePath[i].charAt(0); 
			if ( 'd' == chFlag )
			{	//It is directory
				DeleteDirectory( strRootPath + "/" + strFilePathTmp );
				
				try {
					m_FtpClient.rmdir( strRootPath + "/" + strFilePathTmp );
				} catch (IOException e1) {
					e1.printStackTrace();
					return false;
				} catch (FTPException e1) {
					e1.printStackTrace();
					return false;
				}
				continue;
			}
			//Now is file
			if ( false == DeleteFile( strRootPath + "/" + strFilePathTmp ) )
			{
				trace( "Delete File Fail: " + strRootPath + "/" + strFilePathTmp);
				return false;
			}
			continue;
		}
		
		return true;
	}
	/**
		Just Mk root dir 
	*/
	public void Mkdirs( String strRootPath )
	{
		if ( strRootPath.length() < 1 )
			return;
		int nIndex = strRootPath.indexOf( '/' , 1 );
		if ( -1 == nIndex )
		{
			MkdirOneLayer( strRootPath );
			return;
		}
			
		String strTmp ;
		while ( -1 != nIndex )
		{
			strTmp = strRootPath.substring( 0 , nIndex );
			MkdirOneLayer( strTmp );
			nIndex = strRootPath.indexOf( '/' , nIndex+1 );
		}
		MkdirOneLayer( strRootPath );		//The last layer!
	
	}
	private void MkdirOneLayer( String strOneLayer )
	{

		try {
			m_FtpClient.mkdir( strOneLayer );
		} catch (IOException e) {
			e.printStackTrace();
		} catch (FTPException e) {
			trace( "Directory Maybe already created : " + strOneLayer );
		}
	}
	/*Close Connection*/
	public void Close()
	{
		if ( null != m_FtpClient )
		{
			try 
			{
				m_FtpClient.quit();

				m_FtpClient = null;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色电影在线| 国产视频不卡一区| 欧美在线观看视频一区二区三区| 高清不卡一区二区在线| 国产精品99久久久久久久vr| 精品在线免费观看| 激情五月婷婷综合网| 久久精工是国产品牌吗| 韩国视频一区二区| 国产乱码精品一区二区三区五月婷| 韩国av一区二区三区在线观看| 激情小说亚洲一区| 国产福利一区在线观看| 国产成人综合自拍| 99久久婷婷国产精品综合| 91黄视频在线观看| 欧美色倩网站大全免费| 555夜色666亚洲国产免| 欧美mv日韩mv国产网站app| 精品成人a区在线观看| 国产欧美精品一区| 中文字幕在线观看一区| 亚洲国产一区二区三区| 日本美女视频一区二区| 国产在线精品一区二区三区不卡| 国产成人高清视频| 91片在线免费观看| 欧美日韩免费一区二区三区 | 欧美高清精品3d| 日韩一区二区精品| 久久婷婷色综合| 成人欧美一区二区三区在线播放| 亚洲综合男人的天堂| 狂野欧美性猛交blacked| 国产成人午夜视频| 欧美综合亚洲图片综合区| 日韩激情中文字幕| 国产乱妇无码大片在线观看| 97超碰欧美中文字幕| 欧美一区二区美女| 国产欧美一区在线| 亚洲v精品v日韩v欧美v专区| 伦理电影国产精品| 99精品视频一区| 7777精品伊人久久久大香线蕉最新版| 2020国产成人综合网| 亚洲手机成人高清视频| 免费成人在线播放| av日韩在线网站| 欧美一级免费观看| 国产精品国产三级国产aⅴ中文 | 亚洲女性喷水在线观看一区| 日韩国产高清在线| www.亚洲在线| 日韩午夜中文字幕| 一区二区三区久久久| 国产一区二区三区最好精华液| 色爱区综合激月婷婷| 久久综合九色综合97婷婷| 国产精品高潮呻吟| 天天影视涩香欲综合网| 成人福利视频在线看| 欧美日韩国产系列| 亚洲女同ⅹxx女同tv| 激情综合网激情| 欧美日韩精品二区第二页| 国产精品麻豆视频| 国精产品一区一区三区mba桃花| 91国产精品成人| 国产精品久久久久精k8| 狠狠色丁香久久婷婷综合_中| 欧美日韩精品一区二区| 亚洲乱码国产乱码精品精小说 | 最新国产成人在线观看| 狠狠色伊人亚洲综合成人| 欧美日韩一区高清| 亚洲免费av高清| 成人av午夜电影| 久久久午夜精品理论片中文字幕| 午夜不卡av免费| 在线亚洲高清视频| 亚洲精品欧美专区| jiyouzz国产精品久久| xnxx国产精品| 精品一区二区影视| 欧美一区二区三区视频免费| 亚洲成av人在线观看| 一本到不卡精品视频在线观看| 国产欧美精品一区| 国产成a人亚洲精| 久久精品亚洲精品国产欧美kt∨| 久久aⅴ国产欧美74aaa| 日韩免费性生活视频播放| 日韩国产高清在线| 亚洲电影欧美电影有声小说| 91免费视频网址| 国产精品久久久久久久久免费丝袜| 国产一区二区按摩在线观看| 精品国产电影一区二区| 麻豆91精品视频| 日韩美女视频在线| 韩国成人在线视频| 久久精品水蜜桃av综合天堂| 国内精品在线播放| 国产欧美日韩精品a在线观看| 国产大片一区二区| 国产精品久久国产精麻豆99网站| 国产宾馆实践打屁股91| 国产精品理论片| 91在线免费看| 一区二区三区 在线观看视频| 欧洲一区二区三区在线| 亚洲国产成人高清精品| 51精品久久久久久久蜜臀| 秋霞成人午夜伦在线观看| 日韩一区和二区| 国产揄拍国内精品对白| 国产欧美日韩另类一区| 成人av电影在线网| 亚洲老司机在线| 欧美色网一区二区| 日本欧美一区二区在线观看| 日韩视频一区在线观看| 国产在线不卡一区| 国产精品久久久久久久裸模| 91麻豆免费看| 日韩高清中文字幕一区| 久久免费视频色| 99热99精品| 亚洲成a天堂v人片| 久久青草国产手机看片福利盒子 | 欧洲人成人精品| 丝袜美腿亚洲一区二区图片| 久久亚洲欧美国产精品乐播 | 精品国产乱码91久久久久久网站| 国产成人免费视频网站高清观看视频| 国产精品精品国产色婷婷| 欧美亚洲综合另类| 精品一区二区三区av| 国产精品国产三级国产| 欧美手机在线视频| 国产精品羞羞答答xxdd| 亚洲精品视频自拍| 精品少妇一区二区三区日产乱码 | 国产精品美女久久久久久久| 在线免费观看日本欧美| 蜜乳av一区二区| 中文字幕一区二区三区av| 欧美人体做爰大胆视频| 国产福利电影一区二区三区| 亚洲最新在线观看| 精品国产一区二区三区久久久蜜月 | 国产精品美女久久久久久2018| 91极品美女在线| 国产精品综合一区二区三区| 一区二区三区欧美在线观看| 欧美一区二区三区在线观看视频 | 欧美日韩视频在线一区二区| 国产伦精品一区二区三区在线观看| 综合欧美亚洲日本| 精品国内片67194| 欧美私人免费视频| 国产a区久久久| 免费看黄色91| 一区二区成人在线观看| 久久久亚洲精品一区二区三区| 欧美亚一区二区| 国产成人夜色高潮福利影视| 丝袜美腿亚洲色图| 亚洲欧洲精品一区二区三区| 日韩欧美三级在线| 在线观看日韩av先锋影音电影院| 国产一区二区三区四区在线观看| 亚洲香肠在线观看| 自拍偷自拍亚洲精品播放| 久久青草欧美一区二区三区| 欧美喷水一区二区| 在线一区二区三区做爰视频网站| 国产suv精品一区二区6| 久久成人免费网站| 视频一区二区中文字幕| 亚洲视频狠狠干| 中文字幕一区二区三区不卡在线| 久久青草国产手机看片福利盒子| 欧美一区二区在线免费播放| 欧美自拍偷拍午夜视频| 99国产精品国产精品久久| 国产美女主播视频一区| 欧美96一区二区免费视频| 亚洲成人久久影院| 亚洲综合精品久久| 亚洲黄色小说网站| 中文字幕在线播放不卡一区| 国产欧美日韩另类一区| 久久久电影一区二区三区| 日韩女优毛片在线| 欧美大片一区二区三区| 日韩午夜电影在线观看| 日韩一区二区免费在线电影| 欧美喷潮久久久xxxxx|